LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to rm a list of files returned from another program? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-rm-a-list-of-files-returned-from-another-program-312627/)

neo_in_matrix 04-12-2005 11:19 PM

How to rm a list of files returned from another program?
 
I have a perl script that output file names like this:
/path/file1
/path/file2
/path/file3

Now I want to rm the list of files output by this script. How to do that? I tried myprog|rm, but it does not work.

scuzzman 04-12-2005 11:24 PM

Try this:
Code:

program_name | xargs rm

Harmaa Kettu 04-12-2005 11:24 PM

Code:

for file in `myprog`; do rm $file; done


All times are GMT -5. The time now is 10:41 PM.