I want to serch for a string in all the files in the root directory. i want the search to be limited to only the files in the directory i.e the search to be done only in the files not in the sub directory.
the approaches tried are
1)grep "pattern string"
this command was serching the pattern in all the files in the root directory as well as in the sub directories which is not required.
2)grep "pattern string" `find . -type f -print -o -type d -prune`
this was not giving any result
3) grep -| "pattern" *.txt
it says the pattern not found . but the pattern is present in files in the directory
one approach to this i have thought listing all the files in the root directory and not in the sub directory and then passing the output of this in the grep command. tell me if this is possible.
if possible it would be helpful if i am able to get the rite syntax for find command only.
Can some one please help me with this