Grep string inside double quotes
bash, grep, linux
Solution
Try doing this :
$ cat aaaa
foo"bar"base
$ grep -oP '"\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
Problem
Trying to grep a string inside double quotes at the moment I use this ``` grep user file | grep -e "[\'\"]" ``` This will get to the section of the file I need and highlight the double quotes but it will not give the sting in the double quotes