maszd
maszd

Reputation: 25

change a text with SED command

i want to change this text :

session.save_handler = files

to:

session.save_handler = memcached
session.save_path = "127.0.0.1:11211"

how to change this text with SED command ?

thank you before

best regards,

maszd

Upvotes: 0

Views: 144

Answers (1)

Sahil Gulati
Sahil Gulati

Reputation: 15141

For testing whether my command is working fine or not just hit this. You can even test my 1st command online over this Execute bash command online

echo "session.save_handler =files" | sed 's/session\.save_handler\s*=\s*files/session.save_handler = memcache\nsession.save_path = "127.0.0.1:11211"/'

In case you have this text in your file lets say test.txt just do:

Actual command:

sed 's/session\.save_handler\s*=\s*files/session.save_handler = memcache\nsession.save_path = "127.0.0.1:11211"/' test.txt

Upvotes: 1

Related Questions