1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

tsvファイルの各行のカラム数をカウントする(awk)

Last updated at Posted at 2024-10-29

(自身の備忘録用です)

任意のtsvファイルの各行のカラム数を表示
NF→フィールドの数(カラム数)

cat [ファイル名] | awk -F '[区切り文字、tsvなので¥tを指定]' '{print NF}'

例)
$ cat test.tsv | awk -F '\t' '{print NF}'
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?