I have a unformatted file returned form a SQL query, from which I need to find a regex match and extract a numeric string that follows. The number is enclosed between two double quotes. Note there could be more then one occurrence of a match per line. There are other special characters in the file which should be ignored. Here is the example file:
{ "_id" : "66941672632817171654", "title" : "Some Name (Central)", "stationNameAssoc" : [ { "stationId" : "6248915749115539177", "stationName" : "Default" } ] }
{ "_id" : "4455677484649934117", "title" : "Some Name (Mountain)", "stationNameAssoc" : [ { "stationId" : "7597999415247634177", "stationName" : "Default" } ] }
From this, I want to extract a numeric after "stationId" excluding quotes e.g. 7597999415247634177. How would you do this using awk or bash? thanks