How to remove a particular line in a file?

Solved/Closed
Akshata - 23 Aug 2018 à 10:27
 Blocked Profile - 26 Aug 2018 à 19:06
Hello,
How to remove particular line in a file and replace with --end-- pattern


Related:

4 responses

Blocked Profile
23 Aug 2018 à 17:06
Using what? In notepad, use the Find and replace.
Using sed shuf
Using sed
Blocked Profile
24 Aug 2018 à 17:08
Here is the documentation. https://www.gnu.org/software/sed/manual/sed.pdf

PLease forgive me, I have not used it, but it is close syntax to DOS. Your scope of the question is not direct, you will have to figure out what this model is, and apply your problem to this model. I am not gong to give you the exact code to make it work, as you have asked for a particular line, and the example has it in there.


$ sed '2d a\--end--' input.txt > output.txt



This should be deleting line 2 and inserting --end--. Once again, not tested.


Thank you
Blocked Profile
26 Aug 2018 à 19:06
I really hope that wasn't home work!