문제

locate 'filename' | grep 'pattern' locates files then greps their file names. I want to grep the contents of the file instead.

도움이 되었습니까?

해결책

you have to pass the filenames as arguments to grep:

grep 'pattern' $(locate 'filename')

(the $(...) will evaluate the command and return it's stdoutput)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top