Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

One of the linux commands commonly used during testing [delete the specified file line]

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

I. demand

During the test, you will encounter the situation of deleting the specified file lines, such as deleting useless information in the configuration file.

For example, if you have the following file, delete the last 3 lines.

II. Solutions

1. We know the line number.

Sed-I'21 female 23 Testfile.log

two。 We know the keywords.

Grep-n 'deleted' Testfile.log # get the line number sed-I' 21 Magi 23 Testfile.log first.

3. Use the vi command

Find the line you want to delete and type d3D in command mode to delete it.

Vi dd can be deleted line by line, d (ymurx) d can delete paragraph lines

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report