리눅스

 3916, 1/196 회원가입  로그인  
   송건휘
   (리눅스 기초) find 명령어와 -exec 명령어 질문합니다.!

http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=4309 [복사]


root/a.txt

a.txt 라는 파일에 cat > a.txt로
hello world
라고 입력하고 저장한후

cd 입력후
root ~ 위치에서

find ~ -name "a.txt" -exec grep 'hello'{}\;

이렇게 입력하면
a.txt라는 파일에서 hello 라는 글자를 찾으라는 명령어가아닌가요?
계속 오류나네요..........

지금현재 쳐본 명령어가

find ~ -name "a.txt" -exec grep 'hello'{}\;
find ~ -name "a.txt" -exec grep 'hello'{} \;
find ~ -name "a.txt"-exec grep 'hello'{}\;  
find / -name "a.txt" -exec grep 'hello'{}\;
find ~ -name 'a.txt' -exec grep "hello"{}\;
find ~ -name "a.txt" -exec grep "hello"{}\;


부탁드려요~

  Hit : 5669     Date : 2013/07/01 08:31



    
kumi123 find / -name a.txt -exec cat a.txt | grep hello

요거 비슷하게 하며ㄴ 될꺼에요
2013/07/04  
Chris Ruiel find / -name a.txt -exec grep "hello" {} \; 2>/dev/null 하셔야 될것같네요^^

파일이름을 모르고 문자열만 알고있다면

find / -exec grep "hello" {} \; 2>/dev/null 하시면 될것 같구요!
2013/09/27  
Chris Ruiel 아..밑에 grep 다음에 -l 하시면 됩니다!^^; 2013/09/27  
Chris Ruiel 저 위에 명령어가 안된이유는.... {} 요거랑 \ 때문이예요.. 띄어쓰기 않해주셔서요^^ 2013/09/27