LoginSignup
0
0

More than 3 years have passed since last update.

jq コマンドで配列を CSV 形式などへ変換

Posted at

こんにちは。
jq コマンドを使って、配列を CSV 形式などへ変換しました。separator をコンマ、タブ、空白の場合を行いました。

$ echo '[1.0, 2.0]' | jq -r '.|@csv'
1,2
$ echo '[1.0, 2.0]' | jq -r '.|@tsv'
1   2
$ echo '[1.0, 2.0]' | jq -r '.|@tsv' | tr '\t' ' '
1 2
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0