I need to use sed to parse out some text. I can't use cut because of some syntax it causes with Ansible in this particular case. I was hoping to achieve this just with sed. This is a single line of text.
"_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm5ldC5kdHZvcHMuYW5keXRlc3QwMg:pootest02.catt.net/Internal"
I need to print out everything after the third "(quote) and before the third :(colon).
My expected outcome should be:
record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm5ldC5kdHZvcHMuYW5keXRlc3QwMg
Any help or direction is greatly appreciated.
Try this :
sed -r 's/^".*".*"(.*):.*/\1/'
but if it's a JSON like chepner said in comments, really try jq
这就是最终工作得很好的原因:
sed -n -e 's#.*\\(record:[^:]\\+\\):.*#\\1#p'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.