Good morning
I have a file that is used as the input to expect, it contains commands to sftp files from a remote server and a list of files to get. I would like to check the input file against a list of previously downloaded files so that any that we have already downloaded are removed from the input list. The input file looks like this:
cd /path to files
get filename1
get filename2
cd /path to files/sub directory1
lcd /local path to files/sub directory 1
get filename 3
get filename 4
cd /path to files/sub directory2
lcd /local path to files/sub directory 2
get filename 5
the list of downloaded files looks like this
filename 2
filename 4
What I want to do is delete filename 2 and filename 4
from the input file.
I have tried a for loop reading the downloaded list then passing it through sed
for file_name in `cat downloaded_list`
do
cat input_file | sed "/$file_name/ d" > new_input_file
done
I have also tried grep -EV
neither of which have worked.
Any ideas?
Thanks
Alan
I have a file that is used as the input to expect, it contains commands to sftp files from a remote server and a list of files to get. I would like to check the input file against a list of previously downloaded files so that any that we have already downloaded are removed from the input list. The input file looks like this:
cd /path to files
get filename1
get filename2
cd /path to files/sub directory1
lcd /local path to files/sub directory 1
get filename 3
get filename 4
cd /path to files/sub directory2
lcd /local path to files/sub directory 2
get filename 5
the list of downloaded files looks like this
filename 2
filename 4
What I want to do is delete filename 2 and filename 4
from the input file.
I have tried a for loop reading the downloaded list then passing it through sed
for file_name in `cat downloaded_list`
do
cat input_file | sed "/$file_name/ d" > new_input_file
done
I have also tried grep -EV
neither of which have worked.
Any ideas?
Thanks
Alan