You need "*" at the end, as someone stated above. "*.*" as someone else posted will not work (that's probably an habit imported from DOS/Win. In a tipical *nix OS ...
-
You need "*" at the end, as someone stated above. "*.*" as someone else posted will not work (that's probably an habit imported from DOS/Win. In a tipical *nix OS that will only match files that has a dot anywhere on their name. File that doesn't has a dot somewhere in their names will not be included on the grep if you use "*.*"
-

Originally Posted by
vsemaska
I don't quite understand. First you were searching for the string 'namecard' in files and now you want to search a directory called namecard? If so, and that directory is a sub-directory of the previous one then the command would look like:
Code:
grep -li namecard /media/usbdisk/Documents_2006_2008/namecard/*
or
grep -li namecard /media/usbdisk/Documents_2006_2008/*namecard*/*
Notice that I took out the -R option so as not to do recursive directory searches. This required adding an '*' to the end so it'll search all files.
Hi vsemaska,
Sorry for not making my previous posting clear. I need to search the directory named "namecard" instead of file.
# grep -li namecard /media/usbdisk/Documents_2006_2008/namecard/*
grep: /media/usbdisk/Documents_2006_2008/namecard/*: No such file or directory
# grep -li namecard /media/usbdisk/Documents_2006_2008/*namecard*/*
grep: /media/usbdisk/Documents_2006_2008/*namecard*/*: No such file or directory
# grep -li namecard /media/usbdisk/Documents_2006_2008/*namecard*/
grep: /media/usbdisk/Documents_2006_2008//*namecard*/: No such file or directory
# grep -li namecard /media/usbdisk/Documents_2006_2008/namecard/
grep: /media/usbdisk/Documents_2006_2008/namecard/: No such file or directory
satimis
-

Originally Posted by
i92guboj
You need "*" at the end, as someone stated above. "*.*" as someone else posted will not work (that's probably an habit imported from DOS/Win. In a tipical *nix OS that will only match files that has a dot anywhere on their name. File that doesn't has a dot somewhere in their names will not be included on the grep if you use "*.*"
Noted and thanks
satimis
-

Originally Posted by
satimis
Hi vsemaska,
Sorry for not making my previous posting clear. I need to search the directory named "namecard" instead of file.
# grep -li namecard /media/usbdisk/Documents_2006_2008/namecard/*
grep: /media/usbdisk/Documents_2006_2008/namecard/*: No such file or directory
# grep -li namecard /media/usbdisk/Documents_2006_2008/*namecard*/*
grep: /media/usbdisk/Documents_2006_2008/*namecard*/*: No such file or directory
# grep -li namecard /media/usbdisk/Documents_2006_2008/*namecard*/
grep: /media/usbdisk/Documents_2006_2008//*namecard*/: No such file or directory
# grep -li namecard /media/usbdisk/Documents_2006_2008/namecard/
grep: /media/usbdisk/Documents_2006_2008/namecard/: No such file or directory
satimis
Well, obviously namecard isn't a sub-directory of /media/usbdisk/Documents_2006_2008/. Where is it located? You'll have to use that pathname.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules