Hi friends! 🤓 I am on a gnulinux and trying to list all files in the active directory and it’s subdirectories. I then want to pipe the output to “cat”. I want to pipe the output from cat into grep.
Please help! 😅
Hi friends! 🤓 I am on a gnulinux and trying to list all files in the active directory and it’s subdirectories. I then want to pipe the output to “cat”. I want to pipe the output from cat into grep.
Please help! 😅
Note, you almost never have to use cat. Just leaving it out would have been enough to find your file (although find is still better).
When you want to find a string in a file it’s also enough to use
grep string file
instead ofcat file | grep string
. You can even search through multiple files withgrep string file1 file2 file*
and grep will tell you in which file the string was found.Obligatory link to the Useless Use of Cat Awards
for a moment, I thought OP was looking for cat photos or something.
So I could use something like grep string -R * to find any occurrence of the string in any files in the folder and sub-folders.
thank you!