Delete lines
Moderators: Dorian (MJT support), JRL
Delete lines
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.
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
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.
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.