perl -pli.bak -e 'substr($_, 18, 1) =~ tr/Y/H/ if $. > 1' filename #### perl -pli.bak -e 's/^.{18}\KY/H/ if $. > 1' filename