What does sed mean in linux

王林
王林Original
2020-06-29 11:29:195903browse

Sed in Linux is a non-interactive character stream-oriented editor. sed can process the contents of multiple files and multiple lines at the same time. It can input the entire file to the screen without changing the original file. The command format of sed: [sed [option] 'sed command'filename].

What does sed mean in linux

sed introduction

(Recommended learning: linux tutorial)

sed: Stream Editor text Stream editing, sed is a "non-interactive" character stream-oriented editor. sed can process the contents of multiple files and multiple lines at the same time. It can input the entire file to the screen without changing the original file, or it can input only the content that matches the pattern to the screen. You can also make changes to the original file, but the results will not be returned on the screen.

Sed command syntax format:

sed command format:

sed [option] 'sed command'filename

sed script format:

sed [option] -f 'sed script'filename

sed command option:

-n: Only print lines matching the pattern

-e: Perform sed action editing directly on the command line mode, this is the default option

-f: Change sed The action is written in a file, use –f filename to execute the sed action in filename

-r: Support extended expressions

-i: Directly modify the file content

Let’s take a look at how to use it, as shown in the picture:

What does sed mean in linux

The above is the detailed content of What does sed mean in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn