Cloudkul Support

How to Change the Specific Content in the File using Bash Script ?

sed -i "s/content you want to replace/content you want to replace with/g" /file location/

For example if i want to change “hello” with “hi” under file “intro.txt” located at /home/user/intro.txt then i have to execute:

sed -i "s/hello/hi/g" /home/user/intro.txt

 

Is this article is helpful?

People like and 1 people dislike.

If result is not found or irrelevant, Please contact us.

Submit your request