I'm wondering how to delete all but lines containing a certain word (for example, the equivalent of doing this to a file: grep word file > newFile). In other words, how to delete all lines that DO NOT contain a certain word.
It looked like TextFX Viz would do it -- for example, I tried using TextFX Viz as follows:
1) Create a window with this:
ABC
DEF
ABCDEF
2) Select ABC and then ctrl-C to copy it to clipboard
3) TextFX Viz->Hide all lines containing clipboard text (this should hide the line containing 'DEF')
4) TextFX Vix->Delete Invisible Selection
I presume step 4 should delete the line DEF but it doesn't. (What is 'invisible selection'?)
(How does one show all lines with TextFX Viz? I switch from and then back to the window to do that --when I do it, the line with DEF is back).
Any suggestions for how to delete all lines NOT containing a certain text string, using TextFX or otherwise?
I'm using Notepad++ version 4.7.5
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In addition to the other suggestions that were given to you, you might want to check out the "unofficial" plug-in (called Line Filter) listed in this thread:
This plug-in (which is in its very early stages and is not yet available on Npp-plugins) allows you to highlight a string of text and choose to either keep only lines that contain that string or delete all lines that contain the string. Hope this helps.
-JP
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(I added to that old thread but at one point it didn't display well, and with all the 'nobodies' I thought it'd be better to start a new one.)
I'd prefer an easy method, on par with 'grep word file > newfile'. Also I'd prefer a solution using the default installation (no add-ons).
Using TextFX Viz seems promosing -- it can reduce a file to the desired lines, as described in the post at the start of this thread, but Step 4 doesn't seem to delete the hidden lines. Can anyone explain how to use TextFX Viz to delete hidden lines? What is the 'invisible selection'?
(The only TextFX documentation I'm aware of is what is found in the install directory.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After you have all the lines you don't want hidden you can just simply go back to "TextFX -> TextFX Viz -> Deleted Invisible Selection" and say "abra-cadabra!" Because, just like magic, they're gone! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm wondering how to delete all but lines containing a certain word (for example, the equivalent of doing this to a file: grep word file > newFile). In other words, how to delete all lines that DO NOT contain a certain word.
It looked like TextFX Viz would do it -- for example, I tried using TextFX Viz as follows:
1) Create a window with this:
ABC
DEF
ABCDEF
2) Select ABC and then ctrl-C to copy it to clipboard
3) TextFX Viz->Hide all lines containing clipboard text (this should hide the line containing 'DEF')
4) TextFX Vix->Delete Invisible Selection
I presume step 4 should delete the line DEF but it doesn't. (What is 'invisible selection'?)
(How does one show all lines with TextFX Viz? I switch from and then back to the window to do that --when I do it, the line with DEF is back).
Any suggestions for how to delete all lines NOT containing a certain text string, using TextFX or otherwise?
I'm using Notepad++ version 4.7.5
In addition to the other suggestions that were given to you, you might want to check out the "unofficial" plug-in (called Line Filter) listed in this thread:
https://sourceforge.net/forum/message.php?msg_id=4565227
This plug-in (which is in its very early stages and is not yet available on Npp-plugins) allows you to highlight a string of text and choose to either keep only lines that contain that string or delete all lines that contain the string. Hope this helps.
-JP
(I added to that old thread but at one point it didn't display well, and with all the 'nobodies' I thought it'd be better to start a new one.)
I'd prefer an easy method, on par with 'grep word file > newfile'. Also I'd prefer a solution using the default installation (no add-ons).
Using TextFX Viz seems promosing -- it can reduce a file to the desired lines, as described in the post at the start of this thread, but Step 4 doesn't seem to delete the hidden lines. Can anyone explain how to use TextFX Viz to delete hidden lines? What is the 'invisible selection'?
(The only TextFX documentation I'm aware of is what is found in the install directory.)
I guess the easiest way for you to get what you want is simply post the file here and let others do whay you can do yourself, right?
After you have all the lines you don't want hidden you can just simply go back to "TextFX -> TextFX Viz -> Deleted Invisible Selection" and say "abra-cadabra!" Because, just like magic, they're gone! :)
Didn't you post the same question in the the below thread?
http://sourceforge.net/forum/forum.php?thread_id=1705727&forum_id=331753
There are several suggestions there already. I prefer the Simple Script method, but I'm a little biased because I wrote the Simple Script plugin.
You'll need to download the Simple Script plugin to get it to work. Then you just need to use the following one-line script:
CutLinesWithout("ABC")