Operating System - HP-UX
1820671 Members
2348 Online
109626 Solutions
New Discussion юеВ

Re: delete files in a file

 
SOLVED
Go to solution
Brian Lee_4
Regular Advisor

delete files in a file

I would like to delete all of files in a file.
for example, index.home file contains the list of files that fbackup writes to DDS tape.
I want to delete files whose format is "dbf" in index.home after fbackup is done.

please help
brian lee
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: delete files in a file

while read -r $aa
do
rm $aa
done < index.html

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: delete files in a file

I am going to assume that you mean all files in the list that end with 'dbf':

grep -E 'dbf$' < index_file | while read X
do
echo "File: ${X}"
# rm -f ${X}
done

After you get your pattern exactly like you want it, uncomment the rm.
If it ain't broke, I can fix that.
Leslie Chaim
Regular Advisor

Re: delete files in a file

TIMTOWTDI:

To check:
perl -nle '/dbf$/ and print' index_file

To Execute:
perl -nle '/dbf$/ and unlink' index_file
If life serves you lemons, make lemonade