Col1 Col2 Col3 Col4 Col5; col 5 and beyond should be left alone Col1 Col2 Col3 Col4 The line below, with 4 cols, is a somewhat tricky; don't include \n in column Col1 Col2 Col3 Col4 Col1 Col2 Col3 Col4 don't change whitespace *in* columns... Col1 Col2 Col3 Col4 ...on either end Col2 Col3 Col4 Empty columns still count Col1 Col3 Col4 Col1 Col2 Col4 Col1 Col2 Col3 TeXt in_the vaRious columns(1) is(2) complETEly(3) 654&%$#53^&09 arbitrary...(4) The end is near ... Behavior on lines not containing 4 columns was left unspecified, but passing them through unaltered is probably a good default.