vendredi 17 octobre 2014

How to find a text string within a config file and add two new lines below with one single line command?


Vote count:

0




i am trying to fight that Poodle SSL Bug and alot of configuration files have to be changed by me.


I try to save myself some work and do it by single line commands. Thus i Need to modify - for example - the /etc/lighttpd/lighttpd.conf.


I am looking for ssl.engine = "enable"


And i want to append two new lines BELOW that found string:


ssl.use-sslv2 = "disable" ssl.use-sslv3 = "disable"


I tried with AWK but i cant get it to work due to the spaces and the carriage return.


Happy to see some one liners :)


Here is what i tried (surely did something wrong here):


awk '{a[NR]=$0}/ssl.engine/{a[NR+1]=a[NR+1]"ssl.use-sslv2 = "disable""}{a[NR+2]"ssl.use-sslv3 = "disable""}END{for(i=1;i<=NR;i++)print a[i]}' /etc/lighttpd/lighttpd.conf



asked 26 secs ago







How to find a text string within a config file and add two new lines below with one single line command?

Aucun commentaire:

Enregistrer un commentaire