Re: listing files with spaces, using wildcard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



bruce wrote:
> 
> hey...
> 
> here's one i can't see..
> 
> goat a bunch of files in different dirs.. the files might have spaces
> 
>  1foo_ aa_bb_cc.dog
>  2foo_aa_bbbb_cc.dog
>  3foo_aa_bb _ccc.dog
>  4foo_aa_bb_cc.dog
>  5foo_aa_bb_cc.dog
>  6foo_aa_bb_cc.dog
> 
> i'm trying to figure out how i can do a complete list of all files with
>  *foo*dog
> 
> so i get the files with spaces and underlines...
> 
> i thought simply doing somehting like
> 
>  ls '*foo_*.dog' and surrounding the filename with single quotes would
> work.. but it doesn't.
> 
> thoughts/pointers/etc...
> 
> thanks

You gotta go at it indirectly.

Assuming you've got a directory (or directory structure) like:
    > test=> ls -l
    > total 0
    > -rw-r--r-- 1 sos users 0 2009-02-20 01:55 1foo_ aa_bb_cc.dog
    > -rw-r--r-- 1 sos users 0 2009-02-20 01:55 2foo_aa_bbbb_cc.dog
    > -rw-r--r-- 1 sos users 0 2009-02-20 01:55 3foo_aa_bb _ccc.dog
    > -rw-r--r-- 1 sos users 0 2009-02-20 01:55 4foo_aa_bb_cc.dog
    > -rw-r--r-- 1 sos users 0 2009-02-20 01:56 5foo_aa_bb_cc.dog
    > -rw-r--r-- 1 sos users 0 2009-02-20 01:56 6foo_aa_bb_cc.dog
    > -rw-r--r-- 1 sos users 0 2009-02-20 02:04 dog__
    > -rw-r--r-- 1 sos users 0 2009-02-20 02:02 dogfood
    > -rw-r--r-- 1 sos users 0 2009-02-20 02:04 foo__
    > -rw-r--r-- 1 sos users 0 2009-02-20 02:02 foodog

Then the following pipe ought to give you what you're looking for:
    > test=> find . -print | egrep ' |_' | grep foo | grep dog
    > ./1foo_ aa_bb_cc.dog
    > ./5foo_aa_bb_cc.dog
    > ./6foo_aa_bb_cc.dog
    > ./2foo_aa_bbbb_cc.dog
    > ./4foo_aa_bb_cc.dog
    > ./3foo_aa_bb _ccc.dog
    > test=> 

Should you wish to further process that file-list by extending the
pipe, you'll need to surround the filenames with single quotes.

Hope this helps'ildy,

-S

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux