LoginSignup
1
0

More than 5 years have passed since last update.

cut コマンドは区切れない場合、渡された文字列をそのまま返す

Last updated at Posted at 2018-07-25
$ echo "aaa/bbb/ccc" | cut -d"/" -f3
ccc

👆わかる

$ echo "aaabbbccc" | cut -d"/" -f3
aaabbbccc

👆!!!

空文字を返すものだと思いこんでいたよ...

対策

-s オプションを使う

$ echo "aaabbbccc" | cut -d"/" -f3 -s

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