[PLUG] One-liners
Andrew Brookins
a.m.brookins at gmail.com
Wed Jul 29 00:14:27 UTC 2009
Hey, list,
This is kind of a pedestrian request, but hey, it's like 104 degrees outside.
I wanted to remove all empty files in a directory today, so I typed
this command:
ls -s | grep -e '^ 0' | sed 's/^...//' | xargs -n1 rm -v
Then I was like, WTF, three pipes? And I wondered how many variations
on this kind of thing there were. There's also this one, which I just
pulled from http://www.linux.ie/newusers/beginners-linux-guide/find.php:
find . -empty -maxdepth 1 -exec rm {} \;
But maybe you have a better one? Or if not, maybe you can share your
favorite one-liner?
Andrew
More information about the PLUG
mailing list