0
でのgrepを使用すると、私は次のパターンを使用し、このウェブサイトregexp simulatorでテスト私は、次のubuntuに</p> <p>をグレップを使用して、テストという名前のファイルでパターンを検索しようとしていますUbuntuの
./foldera/[hello]this.mp4
./foldera/folderb/[hello]that.mp4
./folderc/[these]hello.mp4
の内容です検索するには、3つの行が一致しています。
しかし、ubuntuでは、次のコマンドを端末で実行しましたが、動作しません。端末に何も戻っていません。
[email protected]:~$ cat ~/Desktop/test
./foldera/[hello]this.mp4
./foldera/folderb/[hello]that.mp4
./folderc/[these]hello.mp4
[email protected]:~$ cat ~/Desktop/test | grep -E '.*\/[A-Za-z0-9\[\]]+\.mp4'
[email protected]:~$
grepがファイル内のすべての行を検索できない理由は何ですか?
いずれの式でも、角かっこで大括弧をエスケープするためにバックスラッシュを使用できますか?ありがとう –
@LeeTimothyはい、PCREに基づいたほとんどのregexpエンジンで使用されています。 – Barmar