unix commands
awk
awk -F',' 'BEGIN{OFS=":"} {print $1,$2}' input_file ↑input sep. ↑ output sep.
awk 'BEGIN{FS=",";OFS=":"} {print $1,$2}' input_file /* 上のコマンドと同じ */
awk '{print NR" "$0}' hoge.txt /* 行番号の付加 */
awk '$2=="aho" {print $1}' hoge.txt /* $2="aho" であれば $1 を出力 */
sed
sed '/hogehoge/d' aho.txt /* aho.txt 中の hogehoge を含む行を削除して標準出力に */ sed -i '/hogehoge/d' aho.txt /* aho.txt 中の hogehoge を含む行を削除 */ sed -i".old" 's/hoge/baka/g' aho.txt /* aho.txt 中の hoge を baka に書き換える。元ファイル名に .old を付けてファイル名でバックアップする。 */
fuser
fuser -vm /home/home15 /* home15 を使っとるプロセスは誰? */ fuser -k -v -m /usr /* usr を使っちょるプロセスに kill シグナルを */ fuser -n tcp ssh /* ssh port を使ってるプロセスは誰? */
chmod
chmod -R go+rX /Applications/iTerm.app
再起的に group & other に read を付け、ファイルがディレクトリであれば execute も付ける。
Keyword(s):
References:[Software]