Detailed introduction to sed command

零下一度
Release: 2017-06-10 10:44:59
Original
3285 people have browsed it

Introduction sed is an online editor that processes content one line at a time. During processing, the currently processed line is stored in a temporary buffer, called "pattern space", and then the sed command is used to process the contents of the buffer. After the processing is completed, the contents of the buffer are sent to the screen. Then process the next line, and repeat until the end of the file. The file contents are not changed unless you use redirection to store the output. Sed is mainly used to automatically edit one or more files; simplify repeated operations on files; write conversion programs, etc. sed uses parameters [root@www ~]# sed [-nefr] [Action] options and parameters: -n: Use silent mode. In normal sed usage, all data coming from STDIN is usually listed to the terminal. But if the -n parameter is added, only the line (or action) that has been specially processed by sed will be listed. -e: Edit the sed action directly in the command line mode; -f: Directly write the sed action in a file

1. Sample code sharing about the sed command in Linux Detailed explanation

Detailed introduction to sed command

Introduction: Introduction sed is an online editor that processes content one line at a time. During processing, the currently processed line is stored in a temporary buffer, called "pattern space", then

2. Detailed explanation of sed usage

Detailed introduction to sed command

Introduction: sed is an online editor that processes content one line at a time. During processing, the currently processed line is stored in a temporary buffer, called "pattern space", and then the sed command is used to process the contents of the buffer. After the processing is completed, the contents of the buffer are sent to the screen. Then process the next line, and repeat until the end of the file. The file contents are not changed unless you use redirection to store the output. Sed is mainly used to automatically edit one or more files; simplify repeated operations on files; write conversion programs, etc.

3. PHP cannot execute the sed command in the shell script -

Introduction: PHP cannot execute the sed command in the shell script sed command---urgent sed -i '/^BOOTPROTO/d' file path sed -i '/^DEVICE/i\BOOTPROTO=none' file path------solution------- -------------Check whether exec has the authority to execute system commands. Check whether the Apache user has the authority to execute sed commands. ------

4. php cannot implement the sed command in the shell script-

Introduction: PHP cannot execute the sed command in the shell script---urgent sed -i '/^BOOTPROTO/d' file path sed -i '/^DEVICE/i\BOOTPROTO=none' file path------solution- -------------------Check whether exec has the authority to execute system commands. Check whether the Apache user has the authority to execute sed commands------Solution

[Related Q&A recommendations]:

linux - Regarding the mixed use of while read and sed, sed ate the first line of standard input

linux - sed: can't move 'wifi.confl5tFtt' to 'wifi.conf': Input/output error

The above is the detailed content of Detailed introduction to sed command. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!