infoMore than 3 years have passed since last update.
sedやawkと踊(ダンス)っちまった時に見るページ
Last updated at Posted at 2021-04-28
でえじょうだ、どうせみんな大して使いこなせねえ。
sed
sed -n 😀p
sed -e 's/😀/😍/g'
- 「パターン😀」を「文字列😍」に置換する
- パターンは正規表現も使えるみたい
-
/
の区切りは、 #
などの他の記号も使える
例 |
意味 |
sed -e 's/xxx/yyy/g' |
xxx を yyy に置換する |
sed -e 's#/#:#g' |
/ を : に置換する |
awk
awk -F'😀' '{ print $😍 }'
- 行を😀で分割して、😍列目を出力する
-
-F
を省略するとスペースで分割する
例 |
意味 |
awk -F',' '{ print $2 }' |
, で分割して、2列目を出力 |
awk '{ print $3 }' |
スペースで分割して、3列目を出力 |
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
What you can do with signing up