We compare the same line no. in both the files.
Fields in Line 1 of both file match.
In Line 2 all the fields (lll, mmm, nnn, ooo, ppp) donot not match with all fields (rrr, sss, ttt, uuu, vvv) in line 2 of File 2. Similarly the 5th field of 3rd line in both the files donot match.
Hence Line no. 2 and Line no. 3 should get echoed by bash.
Is this a homework item? It seems like a strange set of requirements for any non-classroom project.
You haven't shown the output that you want from the input given above, but it seems that you are asking for entire lines from File 1 or entire lines from File 2 to be written to standard output if any field is different. If that is the case, why should we compare fields instead of just comparing lines? Comparing lines should get the same results, is easier to program, and probably run faster.
If you are using awk to compare files; why is it important that bash use the echo command to print the results instead of having awk print the results directly?
But I want to compare field by field instead of line by line so in case a field does not match I can echo out that field in output.
Hope you understood.
Thanks Don for your quick response.
Please find my comments below:
1). Well this is not a homework assignment. It is part of my performance testing project for a investment bank in US. Actually I have got a .csv file as a output of one application run. Now I need to verify the contents of this .csv file against the expected data.
2). Output will look like this:
Line 2: lll,mmm,nnn,ooo,ppp
Line 3: vvv
3). By echo out the output I meant I wanted to print the output in a file/ $ prompt (through print statement in awk). I did not mean of literally using the "echo" command only.
Hope I have answered all your questions. Please revert back to me in case of any further questions.