LoginSignup
3
5

More than 5 years have passed since last update.

grepで任意の数の空白文字を間に挟む文字列を探す

Posted at
text.txt
aa bb # 半角スペースひとつ
aa  bb # 半角スペースふたつ
aa  bb # \t 
aa bb # 全角スペースひとつ
aa  bb # 全角スペースふたつ

grep 'a[[:blank:]][[:blank:]]*b text.txtする

実行結果

aa bb
aa  bb
aa  bb
aa bb
aa  bb
3
5
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
3
5