Delete lines

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
nkwhftw
Newbie
Posts: 8
Joined: Thu Sep 01, 2005 12:44 pm

Delete lines

Post by nkwhftw » Wed Oct 26, 2005 3:51 pm

I have built a script that will get data and paste it into notepad.txt file. The amount of lines is always random, sometimes 20 and other times 103, etc. I need to delete some lines at the end of the document that will not always be the same number. I have the script find a key word and I would like to delete all the lines below that key word. How can I make the script delete a random number of lines down. I always have to delete everything below the key word.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Oct 26, 2005 4:13 pm

There are good examples for notepad automation. If you have already found the keyword then

end (to move to the end of the line with the keyword if you don't want to delete that line)
control shift end
delete

will do it.

Probably a good idea to include some logic to cover the case that keyword isn't in the file.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts