问题
My server generated a json object for each request, so I dump that json object to a access.log file. In this case, each line of access.log is an json object. So How can I use jsawk to parse access.log ? Is there any option to switch on ?
回答1:
A good work around, use awk to preprocess the access.log like this:
$ awk 'BEGIN {print "[";} {print $0,",";} END {print "]";}' access.log
> | jsawk "return this.sometag"
来源:https://stackoverflow.com/questions/27117843/how-to-use-jsawk-if-every-line-is-a-json-object