![]() |
|
How to Delete Lines From a Particular File Using the sed Command - Printable Version +- My Board (https://ellohost.com/forum) +-- Forum: Tutoriel EN (https://ellohost.com/forum/forumdisplay.php?fid=8) +--- Forum: Others (https://ellohost.com/forum/forumdisplay.php?fid=20) +--- Thread: How to Delete Lines From a Particular File Using the sed Command (/showthread.php?tid=730) |
How to Delete Lines From a Particular File Using the sed Command - aaron - 09-08-2023 How to Delete Lines From a Particular File Using the sed CommandThe delete command removes lines from the current input file without opening the content. There are five sed scripts available:
For example, to remove the first line from the cities.txt file, run the following:
Replace the # symbols with the start and end of the line range. For example, to delete the first, second, and third line from the cars.txt file, enter the following:
For example, to remove the last line from the computers.txt file, run the following:
For example, to remove the second to the last input line from the books.txt file, enter:
For example, to remove the “oabo” pattern from the filestrings.txt file, run:
|