In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to delete long lines in Shell. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
The implementation method of how to delete long lines in Shell
Sometimes need to delete the file to delete operation, this time more commonly used vi command will use the dd command, such as the first implementation of 10G (jump to line 10), and then perform 20dd (delete 20 lines), but the actual situation may not be so conventional, for example, to delete a line in the file, a line length of more than 200 characters, if the text is relatively small, fortunately, if it is tens of thousands of lines, hundreds of thousands of lines? It is not realistic to use vi. The way I can think of is to, for example, use the sed,awk,egrep command to achieve my goal. Give me a simple example.
If you say the following text files, delete those with more than 5 characters in length.
Root@linux# cat data 1 22 333 4444 55555 666666 7777777 88888888
Method 1: use the length () function of the awk command
Root@linux# cat data | awk'{if (length ($0))
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.