2017-02-14 1 views
0

가 좋아요 그래서 기본적으로 내가 그런Cygwin에서 - 그렙 (파일이 포함되어있는 경우)

EMAILS.TXT 

이메일의 목록을 가지고 내가 가진, 이메일을 포함하는 또 다른 무리가 .txt 파일 : PHONENUMBER가 :

Compiled1.txt 
Compiled2.txt 
Compiled3.txt 
... 

이름 grep 또는 gawk를 사용하여 compiled1, compiled2 폴더에서 .txt 파일의 전자 메일이 포함 된 줄을 검색 할 수 있습니까?

그래서 예를

email.txt Contains " [email protected] " & " [email protected] " 

Output > [email protected]:000000:ExampleUser 
     [email protected]:00010101:ExampleUser2 
     ... 

답변

0

당신은 사용할 수 있습니다 emails.txt에서 지정된 포함되어있는 경우

Compiled1.txt & Compiled2.txt have both these lines 

Cygwin에서/Gnuwin을 포함하는 폴더 compiled1 & compiled2에서 라인 출력

grep -Fi -f EMAILS.TXT Compiled*.txt 

EMAILS.TXT의 행을 검색 패턴으로 사용합니다.
-F. 또는 ?과 같은 기호의 특수 처리를 사용하지 않도록 설정합니다.
-i 대소 문자를 구별하지 않는 검색입니다. 당신은 또한 줄 번호에 관심이 있다면,

Compiled1.txt:[email protected]:000000:ExampleUser 
Compiled1.txt:[email protected]:00010101:ExampleUser2 
Compiled2.txt:[email protected]:000000:ExampleUser 
Compiled2.txt:[email protected]:00010101:ExampleUser2 

명령에 -n을 추가

출력 귀하의 예제의 경우 형태

File-in-which-a-match-was-found:Matched-line-from-that-file 

이 될 것입니다.

관련 문제