Path: utzoo!attcan!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.shell Subject: Re: Can U pipe filenames to rm??? Message-ID: <1990Sep28.233843.24650@virtech.uucp> Date: 28 Sep 90 23:38:43 GMT References: <28790001@col.hp.com> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 34 In article <28790001@col.hp.com> greiner@col.hp.com (Mike Greiner) writes: > > Piping filenames to the rm command??? > >I haven't figured out how to pipe this list of names to rm. You don't need to. Pipe the list of names to xargs rm. > ninstall -h $1 -vvvvv -p $2 | grep path | cut -d " " -f4 Just change this to: ninstall -h $1 -vvvvv -p $2 | grep path | cut -d " " -f4 | xargs rm This, of course, assumes you have xargs. If you don't, you can get one of the PD versions that have been posted to c.s.u in the past. Otherwise, if you know that the length of the list is relatively short (i.e. it wont overrun the command line buffer length) you can do the following: rm `ninstall -h $1 -vvvvv -p $2 | grep path | cut -d " " -f4` else you could do the following: ninstall -h $1 -vvvvv -p $2 | grep path | cut -d " " -f4 | while read name do rm $name done -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170