in reply to Make a copy of a line and add it back to the same file
Where do you want to add the new (changed) piece of text? Immediately after the line you modified? At the end of the file? Somewhere else?
A solution like the_pusher_robot's can probably be made to work for you. This might do the trick:
perl -pi.bak -e 's/^cdsadmin\s+-t(.*)/${_}cdsadmin -d$1/' yourfile
I do recommend providing an argument to -i in order to create a backup of the original otherwise a typo might ruin your whole day. ;-)
-sauoq "My two cents aren't worth a dime.";
|
|---|