When writing scripts,I often like to insert text into a file at a very specific location/line.
The following lines of code, will
enable rsync
comment out the line starting with default_password_crypted
insert a new line with default_password_crypted in it's place
The following lines of code, will
enable rsync
comment out the line starting with default_password_crypted
insert a new line with default_password_crypted in it's place
[root@rhnsat01
~]# sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
[root@rhnsat01
~]# sed -i -e
's/default_password_crypted:/#default_password_crypted:/g'
/etc/cobbler/settings
[root@rhnsat01
~]# MYPASS=`openssl passwd -1 -salt 'Passw0rd' 'Passw0rd'`
[root@rhnsat01
~]# sed -i -e '84i'${MYPASS}'' /etc/cobbler/settings
In vi, to see the line you are on (I don't know how to turn the numbers back off though ;-)
: set number
Comments
Post a Comment