Link to home
Start Free TrialLog in
Avatar of atkinsonit
atkinsonit

asked on

BASH - read each line of text file to create a new one.

I have a BASH script that creates a directory of the current date, downloads files via psftp into that current date directory, then creates a text file of the list of files in that current date directory via this command:

ls *.bak > $DATE.list

My $DATE. list text file, for example 20071012.list, looks like this:
20070928-accept.txt
20070927-accept.txt
20070928-beyond.txt
20070925-moved.txt

Now what I need to do is create another text file called $DATE.del which will add the command 'del' to the beginning of each like in the 20071012.list file and place 'quit' at the last line, for example 20071012.del would look like this:
del 20070928-accept.txt
del 20070927-accept.txt
del 20070928-beyond.txt
del 20070925-moved.txt
quit

This has pushed my knowledge of BASH to its limit and I would appreciate any direction on this script.
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial