echo ":os:5.7:" >> /mnt/install_list [text removed here ....] echo ":app:name-here:" >> /mnt/install_list #### echo ":app:new-name-here:" >> /mnt/install_list #### perl -p -i.bak -e 's/echo*install_list(?!.*echo*install_list)/test/m' test.cfg