Add Line to a File ( 3rd line)
Hi...
going back to my earlier post "Last digit minus ONE", when i get a Ip addresse with minus 1 ($ip), i need to add the new Ip address ($ip) to resolv.conf of that system. so from resolve.conf: Code:
# /etc/resolv.conf ....... Code:
# /etc/resolv.conf Code:
sed 'nameserver $ip/domain/G' -f /etc/resolv.conf any better way.... thanks |
You could do it like so:
Code:
cat /etc/resolv.conf | sed -e '3 i $ip' > /etc/resolv.conf.new Hope that helps! Cheers, Josh |
I'm getting fed up with people referring to earlier posts without a link or summary.
Either summarise it or link to it. Don't assume we're following your every word ! |
Quote:
|
Quote:
Quote:
|
Quote:
use double quotes so that your $ip variable can be interpolated. Same to some of the answers posted. |
Thank you for your replies.
|
All times are GMT -5. The time now is 09:00 PM. |