LoginSignup
1
1

More than 5 years have passed since last update.

AWKまじ入門してみた

Posted at

概要

  • テキスト処理やる
  • C言語の文法に似てる

自分Macなんで

$ which awk
/usr/bin/awk

を使います。

書式

ワンライナーで書くと

$ awk '{ 実行する式 }' 処理したいファイル

text.datを処理したいtextとすると

majihuwa1 keshigomu1 150 2016/01/11 01:18:43
majihuwa2 keshigomu2 150 2016/01/01 11:18:43
majihuwa3 keshigomu3 250 2016/01/09 04:18:43
majihuwa4 keshigomu4 500 2016/02/02 02:18:43

例:text.datの3行目を出力

$ awk '{ print $3 }' text.dat
150
150
250
500
1
1
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
1