In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Sed introduction
Sed (stream editor) is a non-interactive stream editor that modifies the text that flows through it through a variety of transformations. By default, sed does not change the original file itself, but simply modifies the text that flows through the sed command and prints the modified results to standard output.
Sed processes text in behavioral units, printing out every line it processes, and then processing the next line until the full text is finished. Sed can do editing actions including delete, find and replace, add, insert, read data from other files, and so on.
The scenarios used by the sed command include the following:
Text that is difficult to edit in a regular editor.
The text is too large to be competent with a regular editor (such as vi, a file of hundreds of megabytes).
Regular text modification to speed up text processing (such as full-text replacement).
The sed command is very powerful, and it is very difficult to master using the sed command because of the complexity of sed itself and its combination with regular expressions. Only by constantly reading and using, can we deeply understand and remember the functions of sed.
Commands commonly used in sed:
Sed command function
An add text after the matching line
C character conversion
D Delete rows
D Delete the first line
I access the text before the matching line
H copy the contents of the template plate to the storage space
H append the contents of the template plate to the storage space
G copy the contents of the storage space to the schema space
G appends the contents of the storage space to the schema space
N read the next input line and use the next command to process the new line
N append the next input line to the template plate and insert a new row between the two
P print matching lines
P prints the first line of the match
Q exit sed
R read text from an external file
W append write file
! Matching inverse
S/old/new replaces the regular expression old with new
= print the current line number
Parameters commonly used in sed:
The function of sed parameters
-e multi-conditional editing
-h help information
-n does not output mismatched lines
-f specify sed script
-V version information
-I modify the original file directly
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.