I am trying to copy lines from source.txt to target.txt. I would like this bash
script to check each line on target.txt if there is duplicate entry before copy.
source.txt contains:
a$$a$$a b**b** c%%cc%% d##d##d## e^^e^^e^^
target.txt contains:
a$$a$$a ee$$ee$$ ff__ff__ gg@@gg@@ zzxxzzxx bb..bb..bb e^^e^^e^^ hh;;hh;;hh
on this scenario, I assuming that there only 3 entries will be copied to target.txt which are:
b**b**
c%%cc%%
d##d##d##
My test code is:
#!/bin/bash
echo "started"
programpath=/home/mysite/www/copyfiles
var str input ; cat "$programpath/source.txt" > $input
var str target ; cat "$programpath/target.txt" > $target
cat $input >> $target
uniq -u "$target"
echo "finished"
exit 1
fi