Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513

    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 "*.*"

  2. #12
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804
    Quote Originally Posted by vsemaska View Post
    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

  3. #13
    Linux Guru
    Join Date
    Sep 2004
    Posts
    1,804
    Quote Originally Posted by i92guboj View Post
    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

  4. #14
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Quote Originally Posted by satimis View Post
    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.

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •