Reputation: 317
I have a file with contents like:
this is text file, \"value\":\"ABCD1000\" , this file contains some weird text, \"value\":\"ABDFD1000\" ...
I want extract all the values like 'value :ABDC1000'
I am using grep command as: grep -o '"value\\":\\\"[a-zA-Z0-9]+\\\"' file.name
But it does not gives any output.
What am I doing wrong here.
I used http://regexr.com/ to check my regex and it looks correct.
Upvotes: 0
Views: 63
Reputation: 88553
With GNU grep:
grep -o '\\"value\\":\\"[^\\]*\\"' file | tr -d '\\"'
Output:
value:ABCD1000 value:ABDFD1000
Upvotes: 2