On 12/27/2016 02:49 PM, JD wrote:
Reading lines from 2 files in such a way that each iteration
lets me read the next line from each file so that the items
read from each file are in sync as far as line number is concerned.
Is this "doable"?
For a single file, indexing to next line is automatic, visa vis
while read line; do
echo $line
done < some_file.txt
You can use the paste command to do the merging:
paste -d '\n' file1 file2
Then it depends on how you want to read the lines, but you could do:
done < <(paste -d '\n' file1 file2)
The first read will get the first line from the first line and the
second read will get the first line from the second file and so on.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx