Friday, April 12, 2013

shellの正規表現

ワイルドカード
$ ls *.txt
abc111.txt abc121.txt abc122.txt abc123.txt
$ ls abc12?.txt
abc121.txt abc122.txt abc123.txt

任意の文字
$ ls abc12[12].txt
abc121.txt abc122.txt

任意の文字列
$ ls abc{111,122}.txt
abc111.txt abc122.txt

任意の文字を除いた文字
$ ls abc12[^1].txt
abc122.txt abc123.txt


参考

No comments:

Post a Comment