My question is how to compare two lines in two separate files? Basically I have two files, file1 contains a line: ${X##*a}file2 contains a line:baaabaababWhat I have tried is:diff -u file1 file2 > file3but that does not give aaaa as it should. Also both files are not always the same, but the difference is always at the begin of the line.I have modified my program so that I now have two vars one with aaaabaaabaabab and one with a. Now I can do the following:echo ${var1##*$var2} > tempfile.txttempfile contains baaabaabab. But how do I get aaaa? I was thinking of:echo ${var1//*$var2} > tempfile.txtbut that does not work.
How to compare two lines in two separate files?
bash