Results 1 to 3 of 3
Thread: Sed to replace entire line
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jun 2012
Sed to replace entire line
domain = example.com #domain will always be domain but example.com will not always be the same
sed -i 's/domain = example.com/domain = newdomain.com/' file.txt
Any suggestions ?
sed -e "/^domain = / c\domain = newdomain.com" file.txt
You maybe want to modify the regex to accept whitespaces.
Once the sed line does what you want, add the -i switch.You must always face the curtain with a bow.
I'd do it
sed -i '.bak' -e"/^domain = .*$/domain = newdomain.com" file.txt/"