-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
  • 51,853
  • 11
  • 92
  • 142
KishoreKumar
  • 93
  • 2
  • 10
  • Maybe use grep `grep '"key"='`? – KamilCuk Jun 23 '18 at 20:54
  • Sorry, but your text and example are not entirely clear. Please study the [**How do I ask a good question?**](https://stackoverflow.com/help/how-to-ask) page. – sidyll Jun 23 '18 at 20:55
  • Please take a look at: [What should I do when someone answers my question?](http://stackoverflow.com/help/someone-answers) – Cyrus Jun 24 '18 at 07:05

1 Answers1

0

Maybe this help?

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

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

lojza
  • 1,351
  • 1
  • 10
  • 21