In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Sed syntax
Sed [OPTION]... {script-only-if-no-other-script} [input-file]...
Sed is a file line processing tool
It is a single-line processing that reads the first line of the file to the pattern space, which is equivalent to the station of the factory pipeline.
There is also a holding space, which is equivalent to h storing temporary data in the schema space and the data in the holding space can be adjusted, such as appending the data replication of the schema space to the holding space. Gju
Since sed is a text processing tool, what is the use of the right?
1sed can modify the contents of a line
There must be a standard for modifying the contents. How do you define a line of characters in a document?
For example, the beginning of a line is represented by ^ and the end of a line is represented by $.
Represents a word boundary\
< \>\ b\ b
Words are defined as letters, underscores, numbers that make up any other character that can be thought of as the boundary of a character.
Modifying the data of a row must match the characters of the row before it can be modified.
1 first line
Line 1 and line 2
1x 2 means odd lines.
2an even number of lines
You can also match through regular expressions.
To match the line at the beginning of root and print it out
You can also use two regular expressions.
Sed-rn'/ regular 1According to the line from the first regular beginning to the first regular 2 in the text and printing
-n turn off default output to the terminal
P print matching lines to the terminal
An append the content to the matching line
I insert content in front of the match
C means to replace matching lines
R read the contents of the specified file to match
W store the matching lines in the specified file
-e supports modification of multiple points
-r supports extended regular expressions
-I modify the file and take effect without adding the option means that it is only displayed on the terminal and does not modify the file.
Fill in regular expressions between s# search and replacement #
G stands for global replacement
Sed syntax
Sed 'delimited matching command' file.
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.