See asfdfdfd #ERRORS pattern to grep pattern to grep CELLS cellpattern abcdef gfghtht #### output: bla bla bla ( different result from other code) bla bla bla ( different result from other code) bla bla bla ( different result from other code) #ERRORS <------------ from file F1 pattern to grep pattern to grep CELLS cellpattern #ERRORS <------------ from file F2 pattern to grep pattern to grep CELLS cellpattern the way my code is written print them out as they parse the line which is not what i want . example of my current result bla bla bla #ERRORS <------------ from file F1 pattern to grep pattern to grep CELLS cellpattern bla bla bla bla #ERRORS <------------ from file F2 pattern to grep pattern to grep CELLS cellpattern