-1

How do I get the all values from a "key"="value" in a file.

Example: I have a text file as below:

"This is the file which contains,"key"="value",so extract value. This is the file which contains another value,"key"="value1",so extract value."

sidyll
  • 54,916
  • 12
  • 100
  • 146
KishoreKumar
  • 143
  • 1
  • 2
  • 11

1 Answers1

0

Maybe this help?

grep -oP '(?<=\"key\"=\")(.*?)(?=\")' file anotherfile

If you don't want filenames in output use -h

lojza
  • 1,667
  • 2
  • 12
  • 23