말 그대로 egrep으로 특정 문자열을 모두 포함 하는 열을 받아 파일로 저장하고 싶습니다. 이때, 검색할 문자열은 매개 변수로 받아지게 됩니다.
egrep "pattern1" data > result egrep "pattern2" result > result
와 같은 형식으로 반복문으로 풀이중인데, result에 값이 저장되질 않네요..ㅠㅠ 어떻게 하면 좋을까요?
egrep "pattern1" data | egrep "pattern2" > result
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html Korean Ver: http://cinsk.github.io/cfaqs/
해결책은 cinsk님이 쓰셨고,
안 되는 이유는 > result 리다이렉션을 처리하기 위해서 일단 result 파일을 빈 파일로 만들어버린 다음에 egrep 이 result 를 읽기 때문입니다.
좋은 하루 되세요!
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
egrep "pattern1" data | egrep
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean Ver: http://cinsk.github.io/cfaqs/
해결책은 cinsk님이 쓰셨고, 안 되는 이유는 >
해결책은 cinsk님이 쓰셨고,
안 되는 이유는 > result 리다이렉션을 처리하기 위해서 일단 result 파일을 빈 파일로 만들어버린 다음에 egrep 이 result 를 읽기 때문입니다.
좋은 하루 되세요!
댓글 달기