Home>Article>Operation and Maintenance> How to replace the sed command in Linux

How to replace the sed command in Linux

WBOY
WBOY Original
2022-02-25 16:24:24 15337browse

Method: 1. Set the parameter "c", c can be followed by strings, these strings can replace the specified lines, the syntax is "sed 'line number c content after replacement'"; 2. Set The parameter "s" can be used for substitution directly, and the syntax is "sed 's/string to be replaced/new string/g'".

How to replace the sed command in Linux

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to replace the sed command in Linux

The Linux sed command uses scripts to process text files.

sed can process and edit text files according to the instructions of the script.

Sed is mainly used to automatically edit one or more files, simplify repeated operations on files, write conversion programs, etc.

Syntax

sed [-hnV][-e