That (like most of the answers) assumes that the lines in the second file are numbered consecutively with no numbers missing.Not so. I suggested sorting file 2 so that the numbers are always increasing. That way a simple walker program suffices and could account for missing numbers. The simple sort strategy is often very effective as the system sort command is usually efficient enough - certainly will be a huge improvement upon read file2 N times!!
In this case, the original poster seems to have disappeared and we are left speculating about requirements that we can't know unless the OP tells us.
In reply to Re^4: Merging larges files by columns
by Marshall
in thread Merging larges files by columns
by ScottJohn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |