input file. The address is a number that represents the line number; a "$" symbol, which indicates the last row. For example:
sed-n‘3p‘datafile只打印第三行
Displays only the file contents of the specified line range, for example:# View only lines 100th through No. 200 of the fileSed-n ' 100,200p ' Mysql_slow_query.logAddresses are separated by commas, the address that needs to be processed is the range between the two lines, incl
"$" symbol, it indicates the last row. For example:
Sed-N '3' datafilePrint only the third row
Only show the file content within the specified row range, for example:# Only view rows 100th to 200th of the file
Sed-N '100,200 P' mysql_slow_query.log
The addresses are separated by commas, so the addresses to be processed are the range between the two rows (including the two rows ). The range
"$" symbol, it indicates the last row. For example:
Sed-N '3' datafile only prints the third row
Only show the file content within the specified row range, for example:# View only the 100th rows to 200th rows of the file sed-N '100,200 P' mysql_slow_query.log
The addresses are separated by commas, so the addresses to be processed are the range between the two rows (including the two rows )
1. Sed introduction
Sed is an online editor that handles a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer, known as pattern spaces, followed by the SED command to handle the contents of the buffer, and the contents of the buffer are sent to the screen af
Sed is a stream editor, which is a very useful tool in text processing and can be used perfectly in conjunction with regular expressions. When processing, the currently processed rows are stored in a temporary buffer called pattern space, followed by the SED command to process the contents of the buffer, and after processing is done, the contents of the buffer ar
Original: http://blog.oldboyedu.com/commands-sed/Syntax formatsed [options] [sed-commands] [input-file]sed [options] [sed command] [input file] Description:1. Note there is at least one space between the SED and the follo
Original URL: http://www.iteye.com/topic/5876731. Introduction to SEDSed is an online editor that processes a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer called pattern space, followed by the SED command to process the contents of the buffer, and after processing is done, the contents of the buffer are sent to the screen. Then the next lin
[extension],--in-place[= extension] directly modify file (if specified extension is backup file)-L-N,--line-length=n specify "L" command Line-Wrapping expected length--posix closes all GNU extensions-R,--regexp-extended uses extended regular expression-s in the script,--separate treats the input file as separate files instead of a long continuous input-u,--unbuf Fered reads the least data from the input file, refreshes the output more frequently--help
Sed is a non-interactive text editor that edits files or Copies files exported from standard input. The standard input may be from the keyboard, file redirection, string or variable, or a pipe file. Sed can edit small or large files at will. There are many sed commands used to edit and delete files and allow them to be absent from the site during this operation.
1. Introduction to SEDSed is an online editor that processes a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer called pattern space, followed by the SED command to process the contents of the buffer, and after processing is done, the contents of the buffer are sent to the screen. Then the next line is processed, so it repeats until the end of
1. Introduction to SEDSed is an online editor that processes a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer called pattern space, followed by the SED command to process the contents of the buffer, and after processing is done, the contents of the buffer are sent to the screen. Then the next line is processed, so it repeats until the end of
http://www.iteye.com/topic/5876731. About SEDSed is an online editor that processes a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer called pattern space, followed by the SED command to process the contents of the buffer, and after processing is done, the contents of the buffer are sent to the screen. Then the next line is processed, so it re
1. Introduction to SEDSed is an online editor that processes a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer called pattern space, followed by the SED command to process the contents of the buffer, and after processing is done, the contents of the buffer are sent to the screen. Then the next line is processed, so it repeats until the end of
DescriptionSed stream editor for filtering and converting textYou can use regular matching, insert and delete text, and so on.When SED is processed, one line is processed at a time, each time the current processing is stored in a temporary buffer, the output buffer content is processed to the screen, and the next line is read into the buffer, so repeat until the last line is processed.Usage:sed [OPTION] ... {Script-only-if-no-other-script} [Input-file
Overview
Sed is a stream editor. Mainly used for automatic editing of one or more files , simplifying the repeated operation of files , writing a translator , etc. This article mainly describes:
how SED works
SED command format and common options
Application examples
Advanced editing commands
Early knowledge of sed and gawk in Linux Command Line and shell script ProgrammingThe sed editor of the Text Processing editor can process data in a data stream based on commands that are input to the command line or stored in the Command text file. It reads a row each time,
sed : Streameditor, stream editor, editing one or more files in an action unit; each SED processes a line of content in a given file. When the SED processes the text, it stores the current row being processed in a temporary buffer, called the "pattern Space", matches the given pattern with the current line, and if it matches, uses
sed CommandWorking mechanism: Each time a line of text is read into "pattern space", the processing is done in the mode space, and the processing result is output to the standard output device;Grammar : sed [OPTION] ... {Script} [Input-file] ...[OPTION] Description- R: supports extended regular expressions; Example: Sed-rn '/(450|300)/P ' testfile- N: silent mod
Note: The reference book for the Sed command is "Sedawk", so the notes are also reference to the book.Basic syntax and commands for SED commands:I. SED command syntaxsed [options] {sed-commands} {Input-file}
For example, to change the zhangsan in all the files under the directory/modules to Lisi, do the following:
Sed-I "s/zhangsan/Lisi/g" 'grep zhangsan-RL/Les'
Explanations:
-I indicates inplace edit, modifying files in place-R indicates searching for subdirectories-L indicates the output file name.
This command combination is very powerful, pay attention to backup files.(1)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.