Reputation: 179
Get a string between two single quotes using only grep function
0x00000000: 00000000 0000000f 00320031 00340033 '........1.2.3.4.'
I want my output as ........1.2.3.4.
I tried grep -o '\'[^\']*'
but it is not working ?
Upvotes: 1
Views: 3848
Reputation: 246799
bash does not allow you to embed single quotes inside a single quoted string. Not even escaped.
You need grep -o "'[^]'*"
If you want to exclude the leading single quote, and if you use GNU grep, then
grep -oP "(?<=').*?(?=')"
Upvotes: 4