Editting the file in Unix

Hi there,

During the lab practise i have found below command to change the IP Address & Port number in app.py files , my doubt is why we are not using VI Editor or this is the quick alternate way to edit the file in CentOS. I am new to Linux so asking this question.

sudo sed -i 's/0.0.0.0/127.0.0.1/

sudo sed -i ‘s/0.0.0.0/127.0.0.1/g;s/8080/5000/g’ /opt/simple-webapp-flask/app.py;

Hi @shafi.shaikh,

Yes you can use VI Editor but sed command is a quick way to replace text in the file.
so in the following example:
sudo sed -i ‘s/0.0.0.0/127.0.0.1/g’
will replace 0.0.0.0 with 127.0.0.1 in the file

Hello, @shafi.shaikh
You can do with vi editor but in the sed command case. e.g. What if there is a multiple lines have one specific word and you want to replace with it. So it’s quite time taken task to do manually edit. So sed command is quite handy in that case.