#! perl -sw use strict; s[(?:\S+ ){2}\K((.).(..))][$2Y$3 $1], print while ; =output C:\test>junk56 col1 col2 cYl3 col3 col4 col5 1234 5678 9Y12 9012 3456 7890 =cut __DATA__ col1 col2 col3 col4 col5 1234 5678 9012 3456 7890