(Using Bash) I am trying to compare a list of hashes against another list of hashes; am thinking a nested for loop or a while loop for each line and then an if statement. Compare the first line to the contents/each line of the second file and so on and so forth.
for a in 'cat file1.sh'
do
echo $a
for b in 'cat file2.sh'
do
echo $b
if [ "$a" == "$b" ]
then
echo $a $b
fi
done
done
I realize I am missing a key comparison here. My attempt is to comparing the first line of the first file to each line/hash of the 2nd file; and then once it finds a match, append it to a new file and go to the second line of the first file and repeat the process until all the match comparisons have been attempted and the matching results are appended to a new file.
bash
alone? You could do this much more easily with other tools, such asgrep
orcomm
. See https://unix.stackexchange.com/questions/155309/outputting-common-lines-from-2-files-and-uncommon-lines-from-both-the-files-in-o – JigglyNaga Jan 26 '17 at 09:43