recentpopularlog in

kme : jq   10

shell - Invoking a script, which has an awk shebang, with parameters (vars) - Stack Overflow |
Using 'env -S' actually works for jq, too (in OS X, anyway).
env is the easiest way to handle this problem:

#!/usr/bin/env -S awk -f

to add more options, and to ensure no interference with your arguments, and awk's arguments:

#!/usr/bin/env -S awk -F: -f ${_} --
# delete argv[1], which == ENVIRON[_]
delete ARGV[1]
} # rest of my awk program

as env has a POSIX standard, this shbang should get you around the difficulties of non-standard shbang implementations across unixen.


after having written this I realized that '-S' is a non-POSIX compliant FreeBSD env extension. So shell wrapper is probably the way to go, unfortunate as that is.
jq  awk  shellscripting  shebang  solution 
october 2017 by kme
perl - How can I convert my JSON to CSV using jq? - Stack Overflow |
Building upon Joe Harris' answer, you can use the @csv filter so that strings are properly quoted and escaped when necessary :

jq -r '[.case, .custom."speech invoked", .custom."input method"] | @csv'
jq  json  csv  importexport  textprocessing  webdevel  solution 
october 2017 by kme

Copy this bookmark:

to read