Re: basic command pipe question

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

 



On Sunday, Jun 18th 2006 at 14:14 -0700, quoth Don Russell:

=>I need some basic CLI help. :-) I've googled, and read, and I can't find how
=>to erase a bunch of files in one go.
=>
=>Specifically, I need a command that will erase *.zip files, regardless of the
=>text case of the .zip part....
=>
=>So far, I have
=>   ls | grep -iE \\.zip$
=>
=>That gives me the correct list of files.... but I don't know how to get rm to
=>process that list.. It doesn't look like rm has an option to read the file
=>name from stdin, it's expecting the file name as a CLI argument.
=>
=>I know this is basic stuff.... I'm obviously missing some fundamental concept
=>of command line processing. :-)

You have gotten three different suggestions so far.

1. Use xargs

ls | grep -i '\.zip$' | xargs rm

2. Use find with -exec

find . -iname \*.zip -exec 'rm {]' \;

3. Use process substitution.

for i in $(find -iname "*.zip"); do rm  $i; done;


Always, wait, should I say that again in reverse, blinking underlined 
text?, *ALWAYS* use form 1.

If you don't understand it, read the man page. Use it. Love it.

Use of 1 will run one skinny process. 

2. will execute a seperate process for *EACH* file to be deleted.

3. will execute a seperate process for *EACH* file to be deleted and would 
potentially overflow before the for loop even starts.

-- 
steveo at syslang dot net TMMP1 http://frambors.syslang.net/
Do you have neighbors who are not frambors?

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[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