[SOLVED] searching directory and subdirectories to no avail
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
thank you for the welcome but both said no such file or directory. the options and patterns listed in man page is difficult for me to understand
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.
I also just tried grep -R 'security = user" /sch
which gave weird results
grep -r /sch "security = user"
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
Ok thanks.
None of those are valid grep statements.
From man grep:
Code:
SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
...
Your first two variations put the FILE, or path part (/sch) before the PATTERN part, "security = user". So it is trying to match the string '/sch' inside a file named "security = user". The third had no file name so it was waiting for you to type the input to search.
Try the first one the other way around and see what it does (try with -r and -l together).
You will have to explain what weird results means as I am not familiar with the technical meaning of "weird"*... paste an example?
*(Actually I am, but that is another context and would require a different thread!)
lol...Weird as in it gave me a few long files that had the folder name but not the "security = user" part in it...but I'm about to test out your explanation in your previous message to see if I get it now (I tried to copy & paste it but it wouldnt let me...also weird)
Your first two variations put the FILE, or path part (/sch) before the PATTERN part, "security = user". So it is trying to match the string '/sch' inside a file named "security = user". The third had no file name so it was waiting for you to type the input to search.
Try the first one the other way around and see what it does (try with -r and -l together).
so I think my might be flickering trying to turn all the way on...
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
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!
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.