There are two files : one with IDs to search for, one full file with 4 lines per data "point" (two of these lines will have the ID in it). The program needs to take in the 1) full file name, 2) ID file name, 3) label to be appended to the ID in the full file. Below, s_6_1_sequence.txt is the full file whereas 0745.tag are the IDs. As you can see, the full file has an ID line, a data line, an ID line, and another data line - repeated over and over. For every case where a line in 0745.tag is found in s_6_1_sequence.txt, that line in s_6_1_sequence.txt needs to have the text "-07-45-ret" appended to the end of it. Below is the count of how many lines each has. % head -n 12 s_6_1_sequence.txt 0745.tag ==> s_6_1_sequence.txt <== @HWUSI-EAS690_0003:6:1:1044:17226#0/1 GAACTGAGAGATTCCACTGGCCTTAGTGGATAGNNNNCNAGAATGTTGCNAAATATCCNNCNNNANNNNNNNNNNNNNNNNNNNNN +HWUSI-EAS690_0003:6:1:1044:17226#0/1 eeeeeeebYbceeeeeaaea\d\d^c_cc_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @HWUSI-EAS690_0003:6:1:1045:13189#0/1 GAACTTCTACTTCTACATACGACTAACCTACTCNNNNTNACTGACCATANTCCCATCCNNANNNANNNNNNNNNNNNNNNNNNNNN +HWUSI-EAS690_0003:6:1:1045:13189#0/1 dbcdda^daddddTcdcddcca`d\ddd\aBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @HWUSI-EAS690_0003:6:1:1045:3930#0/1 GAACTCTTCACGAACTAAGCAAATCAAAATAAANNNNANTCATGCTGCCNACCCCCATNNGNNNCNNNNNNNNNNNNNNNNNNNNN +HWUSI-EAS690_0003:6:1:1045:3930#0/1 e\eeedeedY]bbbT`\`bYY^acbY_T_bBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB ==> 0745.tag <== @HWUSI-EAS690_0003:6:1:1044:17226#0/1 +HWUSI-EAS690_0003:6:1:1044:17226#0/1 @HWUSI-EAS690_0003:6:1:1045:13189#0/1 +HWUSI-EAS690_0003:6:1:1045:13189#0/1 @HWUSI-EAS690_0003:6:1:1045:3930#0/1 +HWUSI-EAS690_0003:6:1:1045:3930#0/1 @HWUSI-EAS690_0003:6:1:1046:4235#0/1 +HWUSI-EAS690_0003:6:1:1046:4235#0/1 @HWUSI-EAS690_0003:6:1:1047:6146#0/1 +HWUSI-EAS690_0003:6:1:1047:6146#0/1 @HWUSI-EAS690_0003:6:1:1047:17493#0/1 +HWUSI-EAS690_0003:6:1:1047:17493#0/1 % wc -l 10220687_61G3EAAXX_s_6_1_sequence.txt 0745.tag 81548300 10220687_61G3EAAXX_s_6_1_sequence.txt 20192266 0745.tag 101740566 total