perl -ni.bak -e "print; /word/ && last;" file.txt