searching directory and subdirectories to no avail
How do I identify a file in a directory called /sch which contains the line: security = user
I need to search in the subdirectories inside /sch as well trying find /sch -name "security = user" literally did nothing and after I hit enter it just went to the next line. |
Welcome to LQ.
Your find command does not find files which "contain" that string, it would potentially only find files with "name" of the same string, hence the "-name" option, and the failure. Try man grep, look at the -l and -r options for starters. |
Quote:
|
What is the actual path that you want to search?
Please paste the exact command that you used and the error message it returned, so we can see better what is going on. |
Quote:
grep -l /sch"security = user" All of them stated no such file or directory grep -l -r "security = user" This one didn't say anything under the line after I hit enter |
Quote:
which gave weird results |
Quote:
None of those are valid grep statements. From man grep: Code:
SYNOPSIS Try the first one the other way around and see what it does (try with -r and -l together). |
Quote:
*(Actually I am, but that is another context and would require a different thread!) |
Quote:
|
Quote:
after reading your explanation I tried this: grep -R "security = user" /sch & it gave me a few folders...2 were really long & they said no such file or directory (which made me wonder why did it even bother listing it if its not there).............................BUT then there are 2 files that say security = user at the end of them |
Great!
Not sure what the other messages were without seeing them, but if it included the ones you were after then you are on the right track! Thanks for following the path to enlightenment, I was not trying to be obtuse, but to get you to see how the man page relates to the syntax, and how the options and order are important! If you can figure out the "extra" messages, post an example here and I am sure I or someone else will know what it means! Also, here is an excellent overview of Linux and the various common commands that you should bookmark and follow: LINUX: Rute User's Tutorial and Exposition And again, welcoem to Linux and LQ! Good luck! |
Quote:
|
You are welcome!
|
All times are GMT -5. The time now is 07:28 PM. |