How to replace a string with another in a file in UNIX

Hey there!

Welcome to ClearUrDoubt.com.

In this post, we will look at replacing a string with another string in a file in UNIX.

We can use the sed command to replace the strings in a file.

Syntax:

sed -i ‘s/<current-string>/<replacement-string>/g’ <file-path>

 

Let’s look at the usage:

 

Happy Learning :).

Please leave a reply in case of any queries.

Leave a Reply

Your email address will not be published. Required fields are marked *