Delete lines of file

Hello,

I have a file "C:\properties.txt"
In the file contains lines that start with “ConfigPoll”

The first is line 72 which I wanna keep, but at the end of the file exists multiple “ConfigPoll” lines. I want to delete all lines containing “ConfigPoll” after line 72.

I am new to this so any help is appreciated.

Thanks!

Haven’t tested it but try something like that (just put the paths/file names):

delete __appendfile
move “<path_to_file>file.ext” “<path_to_file>orgfile.ext”

appendfile {concatenation “%0d%0a” of lines whose ((line number of it >= 72 and it does not contain “ConfigPoll”) or line number of it < 72) of file “<path_to_file>orgfile.ext”}
move __appendfile “<path_to_file>file.ext”

Thank you for your reply!

This works in deleting the lines that start with “ConfigPoll” but it’s also deleting line 72 - so close!

Any other ideas?

Thanks for your help.

Change the logic… from line number of it >= 72 to line number of it > 72

delete __appendfile
move “<path_to_file>file.ext” “<path_to_file>orgfile.ext”

appendfile {concatenation “%0d%0a” of lines whose ((line number of it > 72 and it does not contain “ConfigPoll”) or line number of it <= 72) of file “<path_to_file>orgfile.ext”}
move __appendfile “<path_to_file>file.ext”

3 Likes

Thank you so much…this worked!

1 Like