Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello all I hope someone can help! It would be much appreciated! What I need to do is compare a load of numbers in file1 to a load of numbers in file2. Each number is on a seperate line so
file1 would look like:
0000001
0000006
0000009file2:
0000002
0000003
0000004
0000005
0000006Also note the numbers are in order.
If I was using vb or any normal programming language I would do this with a nested loop but I can't find an efficient was of reading through the lines in a shellscript.
So basically what it should do is look for the first line in file1 in file2 goign through sequencially until it's greater than the value in file1 and keeping the pointer at that line and then incrementing again for line 2 then line 3 ect...
I think this should be the most efficient way of doing this but as I'm new to .sh and .ksh I'm finding it a bit tricky. The reason it needs to be effecient is that the files are HUGE.
Also when a match is found it should output the result to file3.
Many thanks in advance peeps!

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |