Yes it's fine except for the output should also have D[0] D1 DA as I need exact matching i.e. only D in input will not delete D1 and DA from output. And in the addition code, if I dont want the new outfile to be sorted.And it's a simple appending the strings whatever they be without any string matching of file B with file A. So in the addition requirement if A contains B C F[0] and B contains D[0] E output should be D[0] E B C F[0]