Tapatalk

Clear line not starting with substring

Clear line not starting with substring

8

PostJan 31, 2023#1

I need to edit a file and for every line that does not start with <RX I need to replace the line with a ^p.

Is that possible?

6,824625
Grand MasterGrand Master
6,824625

PostJan 31, 2023#2

There are several possibilities to do that. Here are described two possibilities.

There can be executed a Perl regular expression Replace all with the search expression ^(?!<RX).*(?:\r\n|$) and use as replace string either just \r\n to just change the lines not starting with <RX to an empty line or an empty replace string to delete all lines not starting with <RX.

There can be run with Unix or Perl regular expression engine a Find with search expression ^<RX or with UltraEdit regular expression a Find with search expression %<RX and check the advanced option Filter lines with selection of Show to get shown just the lines starting with <RX and use next on ribbon tab Edit in first group Select and delete from popup menu of third item Delete the command Delete all hidden lines.

8

PostJan 31, 2023#3

Works like a charm! Thank you.