Like in the title, and also I want to print the number of the line in each (text) file where the substring occurs.
So far I have:
find /sys | grep "filesystem"
But it appears to only look at the names and directories of files, and not their content.
And how to search for several strings simultaneously? Because I think I should search additionally for "*filesystem"
, "filesystem*"
and "*filesystem*"
to include all possible occurances of the string.
Thank you in advance.
find /sys -name "*filesystem*"
. Also find searches the filenames. Do you also want to search for content? You should use grep for that. Maybe if you posted your code and the details of your expected output, it would helpfind
for the file/directory andgrep
for the content?find
andgrep
seperately. The requirement was ambiguous enough and didn't specifically say I have to do it in one command.