I need to get the value of "name" from this line
"snapshots": [{"name":"sLVZt","user":"comment","current":"n","created":"2015-03-11 05:28:02"},{"name":"ubg9x","user":"test2",{"name":"lo3Qp","user":"test3","current":"y","created":"2015-03-11 06:02:46"}]}
I expect the output to be like this
sLVZt
ubg9x
lo3Qp
If you're on Linux or otherwise have access to GNU grep
, you can do:
$ grep -oP '"name":"\K[^"]+' file
sLVZt
ubg9x
lo3Qp
Alternatively, in Perl:
$ perl -lne 'print join "\n", /"name":"([^"]+)/g' file
sLVZt
ubg9x
lo3Qp
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments