+1 vote
in Linux by
How can we edit a file without opening in Linux?

1 Answer

0 votes
by

sed command is used to edit a file without opening. sed is the acronym for StreamEditor. The “sed” command is used to modify or change the contents of a file

For example, we have a text file with below content

>cat file.txt

We want to replace the content of the file and we want to replace “sed” with “vi”. So, we will use below command for this.

>sed 's/sed/vi/' file.txt

vi command is used to edit a file.

So, sed is replaced with vi in the text.

Related questions

+1 vote
asked May 9, 2021 in Linux by sharadyadav1986
0 votes
asked May 9, 2021 in Linux by sharadyadav1986
...