Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to grep a string inside double quotes using Perl syntax (-Po)
- $ cat aaaa
- foo"bar"base
- $ grep -Po '"\K[^"\047]+(?=["\047])' aaaa
- bar
- I use look around advanced regex techniques.
- If you want the quotes too :
- $ grep -Eo '["\047].*["\047]'
- "bar"
- Note :
- \047
- is the octal ascii representation of the single quote
Add Comment
Please, Sign In to add comment