pipe filenames to rm in unix
February 1st, 2007 by Lawrence David
say you’ve got a stream of filenames that you’d like to remove. for instance, i’ve got a bunch of filenames that pop out of this command:
grep -v “,” `search “boot0.txt”` | sed ‘s/boot.*//’
turns out i can’t directly pipe this to rm. instead, i’ve got to use the xargs command, as so:
grep -v “,” `search “boot0.txt”` | sed ‘s/boot.*//’ | xargs rm -r

Priceless! Thank you!
Awesome!
Thanks it worked
BTW nice blog header ^_^
thanks mate!
great command
very nice menu!!!!
Worked great!!!
Awesome tip and even more awesome header
so much time has passed with this awfull “while read line;do rm $line;done < <(ls things)"… *sigh*
Many thanks !!
have you ever tried vipe?
ex.:
git status -u | vipe | xargs -Rf
Thanks man. xargs eh? Cool.