Is there a way to delete lines that contain a certain string? I can mark all the lines that have the string but don't see a way to delete those "marked" lines.
Ex:
ABC
XYZ
ABCXYZ
12345
I want to delete all lines that contain XYZ
Therefore, lines 2 & 3 are deleted and I am left with only lines 1 & 4
ABC
12345
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Search for the first instance of 'XYZ'. Having found it, record a keystroke macro that deletes the entire line, then searches for the next instance. Play the macro using the "Run until end of file" option. The macro can be
<End> <Home> <Home> <Shift-Down> <Delete> <F2>
Regards.
Greg
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Another solution using macro`s.
Before recording keystroke macro, be sure all your necessary lines are bookmarked. Then record keystroke macro sequence - <F2> for jumping to next bookmarked line, <Ctrl>+<L> for deleting all line, <SHIFT>+<F2> to toggle off bookmark from exact line (if you`ll missed this third point, your macro will find next bookmark on the same line.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Of course, it would be better to remove the Bookmark first and then remove the line.
But just forget about macro's completely. Do what you want to do by using the right tools for it. Take a look at this message and the Text FX Viz menu. You will probably find the solution there yourself:
You could use Regular expression in Replace Dialog, but unfortunately I couldn't create experssion that would delete the new line characters at the end of the line. So with your example:
ABC
XYZ
ABCXYZ
12345
Ctrl+H for Replace dialog. Put the following without the quotes: "^.*XYZ.*$" in 'Find what' and leave 'Replace with' empty, than Click 'Replace All' and you get:
ABC
12345
I hope that works for you. Afterwards you can delete all consequent new lines using the Ctrl+R Find/Replace dialog by entering a new line (Shift+Enter) in Find field.
Here '^' matches start of line '.*' matches any string, 'XYZ' maches "XYZ" and '$' matches end of line.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there a way to delete lines that contain a certain string? I can mark all the lines that have the string but don't see a way to delete those "marked" lines.
Ex:
ABC
XYZ
ABCXYZ
12345
I want to delete all lines that contain XYZ
Therefore, lines 2 & 3 are deleted and I am left with only lines 1 & 4
ABC
12345
Search for the first instance of 'XYZ'. Having found it, record a keystroke macro that deletes the entire line, then searches for the next instance. Play the macro using the "Run until end of file" option. The macro can be
<End> <Home> <Home> <Shift-Down> <Delete> <F2>
Regards.
Greg
Another solution using macro`s.
Before recording keystroke macro, be sure all your necessary lines are bookmarked. Then record keystroke macro sequence - <F2> for jumping to next bookmarked line, <Ctrl>+<L> for deleting all line, <SHIFT>+<F2> to toggle off bookmark from exact line (if you`ll missed this third point, your macro will find next bookmark on the same line.
Except that only works if you don't have 2 bookmarks in a row.
Of course, it would be better to remove the Bookmark first and then remove the line.
But just forget about macro's completely. Do what you want to do by using the right tools for it. Take a look at this message and the Text FX Viz menu. You will probably find the solution there yourself:
"How to: copy lines by regex using TextFX Viz"
http://sourceforge.net/forum/forum.php?thread_id=1964719&forum_id=331754
You could use Regular expression in Replace Dialog, but unfortunately I couldn't create experssion that would delete the new line characters at the end of the line. So with your example:
ABC
XYZ
ABCXYZ
12345
Ctrl+H for Replace dialog. Put the following without the quotes: "^.*XYZ.*$" in 'Find what' and leave 'Replace with' empty, than Click 'Replace All' and you get:
ABC
12345
I hope that works for you. Afterwards you can delete all consequent new lines using the Ctrl+R Find/Replace dialog by entering a new line (Shift+Enter) in Find field.
Here '^' matches start of line '.*' matches any string, 'XYZ' maches "XYZ" and '$' matches end of line.
You could also try using Plugins/Textviz/Hide Line With Clipboard Text to display only the matching lines, then just delete them.
Get any more clues from a message just posted one week ago on this very same forum:
"How to delete all but certain lines"
http://sourceforge.net/forum/forum.php?thread_id=1933510&forum_id=331754