storing the result of grep in a separate file

前端 未结 2 661
悲哀的现实
悲哀的现实 2021-01-29 00:04

I am searching something logs at the following directory

$ cd opt/app/abc/logs

Now the logs folder contains many different logs like



        
相关标签:
2条回答
  • 2021-01-29 00:40

    Just output the command to a file:

    grep -l 456 * > somefile.txt
    

    You can do this for any command.

    0 讨论(0)
  • 2021-01-29 00:42

    Is this what you're looking for?

    grep '456' * > outfile
    
    0 讨论(0)
提交回复
热议问题