perl -ni.bak -e 's/first/last/g if $. == 2; print' one.txt