In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the daily use of linux sed". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the daily use of linux sed".
Sed is a stream editor, and the sed editor processes the contents of the file one line at a time until the end of the file. The content being processed is stored in the pattern space (buffer), and the output or file is modified according to the option after the processing is completed.
Syntax format: sed [options]'[match pattern] command 'file
Common parameters:
-n cancel the default full output, as long as needed
-e allows multiple edits
-I modify the contents of the file
Command:
I (insert insert), insert the file I\ above the current line
A (append append), adding a line a\ after the current line
P print
D Delete
Match character set:
^ match line start
End of $matching line
1.1 matching printing
Sed-n 4p file # View the specified number of rows
1.2 add characters to the specified line
Sed-I "2i aaa\ nbbb" file
1.3 add commas
Sed-I "s / g" fiel # remove spaces
Sed-I ": a Ting Nathanz /\ nGrammer Magneol Universe GMP ba" plus a comma
1.4 string substitution
Regular replacement of sed's Universe BBG 'file #
Sed'/ cc/s/aa/bb/' file # match replacement
Sed'1 replacements 4sUniqqa _ BBG'# 1 to 4 lines
1.5 match deletion
Sed'/ aa/d' file # match deletion
Sed '1d3d' file # Delete 1 to 3 lines
Sed'/ ^ # / dscape / ^ $/ d' # Delete lines that start with # and blank
1.6 multiple edits (- e)
Sed-e '1mai 2d'-e's Unix AA Unix bb Unique 'file
1.7 add content at the end of the file
Sed-i.bak'$an aa' file
At this point, I believe you have a deeper understanding of "the daily use of linux sed". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.