[Shell] cut: cut out selected portions of each line of a file

ファイルから指定したフィールドを取り出す。

[markdown]
“`prettyprinted
% which cut
/usr/bin/cut
“`

sample.csv として以下を用意。

“`prettyprinted
% cat sample.csv
apple,138
orange,10304
grape,5034
peach,192
banana,782
“`

`-d` … Delimiter として `,` を指定。
`-f` … 2 つめの Field を指定。

“`prettyprinted
% cut -f 2 -d , sample.csv
138
10304
5034
192
782
“`

> * [@IT:テキストファイルから指定したフィールドを取り出すには](http://www.atmarkit.co.jp/flinux/rensai/linuxtips/350getfldtext.html)
[/markdown]