One of the linux commands commonly used during testing [delete the specified file line]
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