0
내가 사용하여 GREP은
다음 우분투
에 그렙를 사용하여 테스트라는 이름의 파일에서 패턴을 검색하려고이 웹 사이트 regexp simulator, 내가 사용하는 다음과 같은 패턴에 시험./foldera/[hello]this.mp4
./foldera/folderb/[hello]that.mp4
./folderc/[these]hello.mp4
의 내용입니다 검색하고 작동하면 세 줄이 일치합니다.
.*\/[A-Za-z0-9\[\]]+\.mp4
그러나 우분투에서
, 나는 아무것도 터미널에 반환했다, 터미널에서 다음 명령이 작동하지 않습니다 달렸다.[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