How to remove a particular line in a file? [Solved]

Akshata - Aug 23, 2018 at 10:27 AM - Latest reply: ac3mark 10525 Posts Monday June 3, 2013Registration dateModeratorStatus September 21, 2018 Last seen
- Aug 26, 2018 at 07:06 PM
Hello,
How to remove particular line in a file and replace with --end-- pattern


See more 

Your reply

6 replies

ac3mark 10525 Posts Monday June 3, 2013Registration dateModeratorStatus September 21, 2018 Last seen - Aug 23, 2018 at 05:06 PM
0
Thank you
Using what? In notepad, use the Find and replace.
Respond to ac3mark
0
Thank you
Using sed
Respond to Akshata
ac3mark 10525 Posts Monday June 3, 2013Registration dateModeratorStatus September 21, 2018 Last seen - Updated by ac3mark on 24/08/18 at 05:08 PM
0
Thank you
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.


Respond to ac3mark
0
Thank you
Thank you
ac3mark 10525 Posts Monday June 3, 2013Registration dateModeratorStatus September 21, 2018 Last seen - Aug 26, 2018 at 07:06 PM
I really hope that wasn't home work!
Respond to Akshata