1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
$ fq -h csv
csv: Comma separated values decoder
Options
=======
comma="," Separator character
comment="#" Comment line character
Decode examples
===============
# Decode file as csv
$ fq -d csv . file
# Decode value as csv
... | csv
# Decode file using csv options
$ fq -d csv -o comma="," -o comment="#" . file
# Decode value as csv
... | csv({comma:",",comment:"#"})
TSV to CSV
==========
$ fq -d csv -o comma="\t" to_csv file.tsv
Convert rows to objects based on header row
===========================================
$ fq -d csv '.[0] as $t | .[1:] | map(with_entries(.key = $t[.key]))' file.csv
|