Find the answer to your Linux question:
Results 1 to 2 of 2
Hey y'all. I have a problem that i'm working on that would be very helpful if you guys could help me, or give me hints on what i'm doing wrong.. ...
  1. #1
    Just Joined!
    Join Date
    Feb 2012
    Posts
    1

    help using find command

    Hey y'all. I have a problem that i'm working on that would be very helpful if you guys could help me, or give me hints on what i'm doing wrong..

    The question is asking for me to list all files from the first 9 days of August..

    to list all the days of august all I do is

    find/usr/local/tmp/election2008/Aug

    to find all the files from the first 9 days of august, I thought i would just do

    find/usr/local/tmp/election2008/Aug -name Aug0*

    Which works, but then I noticed that there are files

    /usr/local/tmp/election2008/Aug/Aug01.csv
    /usr/local/tmp/election2008/Aug/Aug02.csv
    /usr/local/tmp/election2008/Aug/Aug03.csv
    /usr/local/tmp/election2008/Aug/Aug04.csv
    /usr/local/tmp/election2008/Aug/Aug05.csv
    /usr/local/tmp/election2008/Aug/Aug06.csv
    /usr/local/tmp/election2008/Aug/Aug07.csv
    /usr/local/tmp/election2008/Aug/Aug08.csv
    /usr/local/tmp/election2008/Aug/Aug09.csv

    but I also need these files...

    /usr/local/tmp/election2008/Aug/aug01.xls
    /usr/local/tmp/election2008/Aug/aug02.xls
    /usr/local/tmp/election2008/Aug/aug03.xls
    /usr/local/tmp/election2008/Aug/aug04.xls
    /usr/local/tmp/election2008/Aug/aug05.xls
    /usr/local/tmp/election2008/Aug/aug06.xls
    /usr/local/tmp/election2008/Aug/aug07.xls
    /usr/local/tmp/election2008/Aug/aug08.xls
    /usr/local/tmp/election2008/Aug/aug09.xls

    how would i make it so I search for Aug0* and aug0*

    any help would be appreciated, Thanks!

    Solved , find /usr/local/tmp/election2008/Aug -name [Aa]ug0*
    Last edited by stsnoopy; 02-12-2012 at 09:46 PM. Reason: SOLVED

  2. #2
    Linux User
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    262
    In Unix (and Linux) the shell expands wildcards not the application. In this case, you wish to give a wildcard as an argument. This is a normal situation when using "find". To prevent the shell from expanding it you need to put it inside single quotes. As far as getting both upper and lower cased "A" you will nedd to use:

    Code:
    find  /usr/local/tmp/election2008/Aug  -name  '[Aa]ug0*'

Posting Permissions

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