Re: basic command pipe question

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

 



Todd Zullinger wrote:
Sam Varshavchik wrote:

WTF????????

Is everyone on drugs, here?

In the current political climate I feel it's best to refrain from answering that. (Insert dope-smoking smiley here. :)

Or did:

rm -f *.zip

suddenly stop working, for some stupid reason?

I believe the wrinkle the OP had was trying to match case insensitively. The simplest method for that is

rm -f *.[Zz][Ii][Pp]

Which has already been posted.

Other than that, the other methods are just good ways to illustrate how many ways you can chain together commands. It's just a fun exercise. :)

Here's another, that ensures the file has both the right extension *and*
content:

rm \
`find . -name "*.[Zz][Ii][Pp]" | \
file -f - | \
grep "Zip archive" | \
sed -e "s/: .*//"`

(force switch omitted)

So this will not delete zip compressed "xpi" files, nor extensionless
zip files, nor non-zip files with (for whatever reason) zip extensions.

To catch all zip files regardless of extension (or lack thereof) you
would simply omit the "-name" argument to "find".

--
K.

--
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