This is my script.
while read lineA; do
while read lineB; do
if [[ ${lineA##*/} == ${lineB##*/} ]]; then
printf "${lineA##*/} and ${lineB##*/} match\n"
else
printf "${lineA##*/} and ${lineB##*/} don't match\n"
printf "$lineA\n" >> file2 # Add Line if Not in file2
fi
done < file2
done < file
The script endless runs and in file2 adds endless lines.
It is reading right. I was trying to get line 1 in file to read through each line in file2 adding only new lines to file2 if not in file2. Repeating line 2 in file through each line in file2 adding only new lines to file2. Reading all lines in file till done. What can I do to correct this?
Hoping for: Script
Hoping for: Script
Checking 'Bull.txt' in file2
Fox.txt don't match
Zebra.txt don't match
Adding Bull.txt to file2
Checking 'Cat.txt' in file2
Fox.txt don't match
Zebra.txt don't match
Cat.txt is a match
Not Adding Cat.txt to file2
And Than: checking file2
Fox.Fox.txt
Zebra.Zebra.txt
Bull.Bull.txt
Cat.Cat.txt
only
Aucun commentaire:
Enregistrer un commentaire