开发者

If I grep recursivley through a directory, how can i save the resulting output to a simple .txt file?

开发者 https://www.devze.com 2023-03-24 01:26 出处:网络
So for example, if I used the command: grep -r \"search\" * could I use a command to save the resulting out开发者_JAVA技巧put to a .txt file?grep -r \"search\" * > somefile.txt

So for example, if I used the command:

grep -r "search" *

could I use a command to save the resulting out开发者_JAVA技巧put to a .txt file?


grep -r "search" * > somefile.txt

This kind of redirection is not specific to the command you are running, by the way. It is a feature of the command shell. The standard shell in linux is called bash. man bash should give you more information than you probably want, but look for the section called REDIRECTION for a comprehensive discussion of these features.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号