In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Linux's sed". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use Linux's sed.
Sed is a text processing tool that adds, replaces, deletes data according to specified conditions.
-an append to add one or more lines after the current line
-c line replacement replace the original data row with the string after c
-I insert, insert one or more rows in the current row
-d Delete the specified line
-p print out the specified line
The-s string substitution replaces one string with another in the format "line range s / old string / new string / g", which is similar to the replacement format in vim.
# p print command
Sed-n "p" passwd
# locate the line
# sed-n "10p" passwdoperator:x:11:0:operator:/root:/sbin/nologin# sed-n "/ root/p" passwdroot:x:0:0:root:/root:/bin/bashoperator:x:11:0:operator:/root:/sbin/nologin
Row interval
# cat passwd | sed-n '10pm 20p'
# a New Line
# nl passwd | sed '5aMui'
# I insert rows
Nl passwd | sed'5i Murray'
# c replace
Nl passwd | sed'5c replace current line'
# d Delete
Sed '1d' passwd # Delete the first row of data sed' 2Magazine 4d' passwd # Delete 2d4 rows of data # nl passwd | sed'/ mysql/ d' # Delete matching mysql data here, I believe you have a deeper understanding of "how to use 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.