0
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?

More than 5 years have passed since last update.

awkの便利な使い方まとめ

Posted at

経緯

仕事で割とcsvからデータ抽出したり、ログ調査とかでawk使うけど、あれってどうやるんだっけ的備忘録
特定フィールド抜き出すようなよくある使い方は載せない

特定フィールドが一致する行を抽出

第7フィールドが5の行を表示
$0は一行(フィールド)全ての意味

cat hoge.csv | awk -F',' '$7==5 {print $0}'

列集計(特定フィールド集計)

第1フィールドを集計して表示

cat hoge.csv|awk -F',' '{a+=$1}END{print a}'
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?