I have a 17k lines-long file
F1 with 8 fields per line formatted as follows:
id1 field2 field3 field4 field5 field6 field7 field8 id2 field2 field3 field4 field5 field6 field7 field8
The second file
F2 content unfolds in a single field per line (one column)
id1 uuuuuuu bbbbbbb aaaaaaa id2 ttttttt qqqqqqq ...
The lines from
F2 should be replaced with the lines from
F1 if there is a match. Thought the weird while loop below could work but, needless to say, it returns all the lines from
F2 per change made. Or probably Bash may have other magical tools that could do the trick, perhaps?
while read id1 id2 id3 id4 id5; do while read ID; do if [[ $ID == "$id1" ]]; then sed "s/$ID/$id1 $id2 $id5 $id4/" F2 && break fi done < F2 done < F1