Script to read file locations from text and then use rm to remove read file?

hexstar

Registered
Hello, I have a icky situation of a bunch of bad aliases on my server and need to remove them. I have been able to do a search in terminal that lists all the aliases however taking each file line and using rm to remove the alias would be tedious at best. Is there (or could someone please make?) a script that would read from a textfile (in which I'd put all the file lines) the files to delete and then use rm or some other facility to delete each alias? Thanks! :)
 
cat textfile | xargs rm

(I normally use xargs with find to remove files, since -exec rm{} ; is so
hard to type, like find . -name '*.bak' -print | xargs rm) but in your case
it was better to put the filenames in the file to be sure that they are correct
files.)
 
Back
Top