Hello guys,
I have two files (file1 and file2):
file1 has the following contents (each separated by a line):
----
100
300
500
----
file2 has the following contents:
-----
200
100
400
-----
I've created a 'for loop' that goes through and displays each line of those files (easy part). Now here's the part that I'm having some issues in doing:
I would like for each line in those files to get compared with each other. So the script will run and display the first line of file1 (100), and then the script will compare the first line of file1 with the first line of file2 (200). Then it would print out which line has the greater value.
So in my case above, the comparison would be 'if 100 < 200', do 'blah'. I know how to run if statements, but I'm just having a hard time on how I can compare line by and display the results. Both files have the same amount of lines (all of the lines are just an integer), so the script would stop once it compared each line between both files. I'm sure there's a solution somewhere in google, however I just don't know what search criteria I should use, and therefore I have not found anything that would help.
Any help on this would be appreciated.
I have two files (file1 and file2):
file1 has the following contents (each separated by a line):
----
100
300
500
----
file2 has the following contents:
-----
200
100
400
-----
I've created a 'for loop' that goes through and displays each line of those files (easy part). Now here's the part that I'm having some issues in doing:
I would like for each line in those files to get compared with each other. So the script will run and display the first line of file1 (100), and then the script will compare the first line of file1 with the first line of file2 (200). Then it would print out which line has the greater value.
So in my case above, the comparison would be 'if 100 < 200', do 'blah'. I know how to run if statements, but I'm just having a hard time on how I can compare line by and display the results. Both files have the same amount of lines (all of the lines are just an integer), so the script would stop once it compared each line between both files. I'm sure there's a solution somewhere in google, however I just don't know what search criteria I should use, and therefore I have not found anything that would help.
Any help on this would be appreciated.