topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 3:32 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: Text editor with filtering of lines  (Read 36301 times)

vixay

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 140
  • ViXaY
    • View Profile
    • Donate to Member
Text editor with filtering of lines
« on: November 26, 2009, 01:05 AM »
This has been driving me nuts.
I need a text editor that can do filtering of lines in view like dopus. If you have ever used dopus you know that you can filter the visible files by typing wildcard masks (e.g. *txt) ...etc

What I want is something similar but for lines in text files, using regex/wildcards/characters. Almost all editors (ultraedit, pspedit, notepad++) have this feature in find and replace, with ability to list output in separate window ...etc but none do it in place.  

This is basically useful for when i need to find certain types of lines in files and edit them. Visually narrowing the file from a bunch of lines to just a few entities that I'm interested in quickly to edit is very appealing and necessary!
Especially for log files, xml files ...etc.

The key difference is I want to have it in-place (i.e. in the editor window itself). The editor can collapse the other lines or hide them from view in another way, I don't care.
Similar to incremental search, but this is incremental filtering.
Similar to Find all, but this is in editor view
 

Does anybody know of  any text editor that can do this? I bet emacs can but I don't know how, I wouldn't mind using that as my default text editor if it did this!

/edit: an editor, not a viewer, I know grep and other viewers exist for filtering lines.
"Drunk on the Nectar of Life!" -me

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #1 on: November 26, 2009, 01:10 AM »
that's an interesting feature idea for a mini text editor.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #2 on: November 26, 2009, 02:27 AM »
Not sure if it's exactly what you want but you could try vim.  It has views and somebody mentioned folding.  It may be useful and there are Windows ports of it for free.  May be worth a look anyway.

vixay

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 140
  • ViXaY
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #3 on: November 26, 2009, 02:49 AM »
I have gVimPortable installed, and i fired it up, loaded a file, and then i'm lost. Do you have any specific directions?

/edit: found the following after looking through the help files that could help. Any idea on how it would work for say 'fold all lines that don't contain the string popup'
==============================================================================
*28.8* Folding by expression

This is similar to folding by indent, but instead of using the indent of a
line a user function is called to compute the fold level of a line.  You can
use this for text where something in the text indicates which lines belong
together.  An example is an e-mail message where the quoted text is indicated
by a ">" before the line.  To fold these quotes use this: >

:set foldmethod=expr
:set foldexpr=strlen(substitute(substitute(getline(v:lnum),'\\s','',\"g\"),'[^>].*','',''))

You can try it out on this text:

> quoted text he wrote
> quoted text he wrote
> > double quoted text I wrote
> > double quoted text I wrote

Explanation for the 'foldexpr' used in the example (inside out):
   getline(v:lnum) gets the current line
   substitute(...,'\\s','','g') removes all white space from the line
   substitute(...,'[^>].*','','') removes everything after leading '>'s
   strlen(...) counts the length of the string, which
is the number of '>'s found

Note that a backslash must be inserted before every space, double quote and
backslash for the ":set" command.  If this confuses you, do >

:set foldexpr

to check the actual resulting value.  To correct a complicated expression, use
the command-line completion: >

:set foldexpr=<Tab>

Where <Tab> is a real Tab.  Vim will fill in the previous value, which you can
then edit.

When the expression gets more complicated you should put it in a function and
set 'foldexpr' to call that function.

More about folding by expression in the reference manual: |fold-expr|

==============================================================================
"Drunk on the Nectar of Life!" -me
« Last Edit: November 26, 2009, 03:09 AM by vixay »

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #4 on: November 26, 2009, 02:59 AM »
EditPad Pro.  There's a "Fold" option in the search panel that does exactly this.

vixay

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 140
  • ViXaY
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #5 on: November 26, 2009, 03:32 AM »
mwb1100, Thanks! :up: I downloaded and tried it and it works as advertised! Simply brilliant :-*. Now I have to get used to a new text editor... :/
I use PSPad , Notepad2, Notepad++ on a regular basis, not I have to replace one of those with editpad i think.

Though the pro version is demo, and the feature is not available in the light version. Any freeware out there that can do this?
"Drunk on the Nectar of Life!" -me

Paul Keith

  • Member
  • Joined in 2008
  • **
  • Posts: 1,989
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #6 on: November 26, 2009, 04:46 AM »
Is there a Cross-OS alternative to this feature?

xtabber

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 618
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #7 on: November 26, 2009, 12:46 PM »
Kedit does this, and much more in that vein. For example, you can restrict the view to those lines that contain a target pattern, then mark a rectangular block in the visible scope and modify, copy or move it elsewhere.  But Kedit is most definitely not freeware.

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #8 on: November 26, 2009, 01:24 PM »
Though the pro version is demo, and the feature is not available in the light version. Any freeware out there that can do this?

I'm not aware of any freeware that does this (but it's not a feature that I look for, either). I actually didn't know off the top of my head that EditPad did this, but it was the first editor I thought of because JGSoft has put a lot of searching/regex capabilities into the editor. JGSoft's core technology and products seem to be oriented around regular expressions.

I took a look at Visual Studio, PSPad, HippoEdit and ConTEXT and couldn't find a similar capability. (I didn't check UltraEdit because I was pretty sure it wasn't there, and you had already mentioned that you looked there).

Unfortunately, I don't think JGSoft does discounts on EditPad Pro very often.  I think the author has been asked about providing a DC discount a couple times with no result (at least no result that we'd like to see). I managed to pick it up when it was on BitsDuJour back in December, but I have no idea if a BDJ discount might be in the cards or not some time in the future.  Maybe last December's discount was the first of an annual 'Christmas' discount.  But, probably not.


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #9 on: November 26, 2009, 02:11 PM »
I have gVimPortable installed, and i fired it up, loaded a file, and then i'm lost. Do you have any specific directions?

Sorry but I just used vi editor a bit when I used to mess around with Linux.  I'm sure it's changed a lot over the years.  But even back then you could run complex commands over the contents and move paragraphs around and do quite a bit once you got the hang of it.  I didn't like the feel of going in and out of edit/command mode, but I used it just enough to see how people who stuck with it would get very fast once into the mind set.  I try to stay away from regular expressions as it's too much mental strain to try to figure out what happens with such and such a pattern.  Command line globbing is about as far as I want to get into it.  Gave up on Perl and Ruby because that substitution stuff is too draining for me.  Like vi, I know there are adherents who love to use those type of features.  Gives me a headache though.

Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,466
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #10 on: November 27, 2009, 12:32 PM »
I have gVimPortable installed, and i fired it up, loaded a file, and then i'm lost. Do you have any specific directions?
1) There is a "vimtutor". Use it wisely.
2) There is a help function, call it via :help <term>...

AFAICS Vim does not feature a built-in filter but it works with grep etc. (while I hope I'm just wrong as Vim features anything).
You could however use expression-based foldering which does not actually hide unwanted lines but folds them.
However, that would require basic understanding of Vim's regular expression syntax.

 :Thmbsup:
« Last Edit: November 27, 2009, 12:37 PM by Tuxman »

AbteriX

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,149
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #11 on: November 27, 2009, 04:53 PM »
I need a text editor that can do filtering of lines in view like dopus. If you have ever used dopus you know that you can filter the visible files by typing wildcard masks (e.g. *txt) ...etc

What I want is something similar but for lines in text files, using regex/wildcards/characters. Almost all editors (ultraedit, pspedit, notepad++) have this feature in find and replace, with ability to list output in separate window ...etc but none do it in place. 

This is basically useful for when i need to find certain types of lines in files and edit them. Visually narrowing the file from a bunch of lines to just a few entities that I'm interested in quickly to edit is very appealing and necessary!
Especially for log files, xml files ...etc.

The key difference is I want to have it in-place (i.e. in the editor window itself).
I know what you mean, i wanna do the same in the past to, but...
Perhaps its just an habit of use?
Basically in HippoEDIT you can "Highlight" and  "Bookmark"  all lines containing 'popup'
so you have an visual filter of---  and in "Bookmark Output" an clickable list of all matched lines.
Find_and_Bookmark001.PNGText editor with filtering of lines

With VIM i would just do an search and jump with 'n' and 'N' through the matched lines.
VIM_search01.PNGText editor with filtering of lines

electronixtar

  • Member
  • Joined in 2007
  • **
  • Posts: 141
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #12 on: November 28, 2009, 08:28 AM »
TextMate with console commands  ;D

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #13 on: November 28, 2009, 03:56 PM »
Kedit does this ... But Kedit is most definitely not freeware.

Not tried by me, but maybe The Hessling Editor, THE ?

THE is a powerful text editor modelled on the VM/CMS text editor XEDIT with the best features of Mansfield Software's Kedit.

Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,466
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #14 on: November 28, 2009, 04:02 PM »
I doubt that THE is easier to use than Vim.

AbteriX

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 1,149
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #15 on: November 29, 2009, 02:49 PM »
Or use Notepad++ with TextFX-Plugin:

Notepad++_HideLines.PNGText editor with filtering of lines

vixay

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 140
  • ViXaY
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #16 on: November 30, 2009, 08:39 PM »
Or use Notepad++ with TextFX-Plugin:
 (see attachment in previous post)

Cool! I did not know this! I use Notepad++ on a daily basis, now i know how to go about it.
You know I'm beginning to think that all feature rich applications should have a built-in command line that matches and shows features. This way it would make it easy for power users to quickly find advanced features and such.
E.g in excel when you begin typing a function name. Emacs. Ubiquity for firefox? ...etc.
Just the other day i was looking for some advanced feature and i'd be damned if i could remember it, that's why i have to maintain a notes list with all the tricks that i use to refer to when i want to repeat the process.

"Drunk on the Nectar of Life!" -me

Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,466
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #17 on: December 01, 2009, 05:03 AM »
You know I'm beginning to think that all feature rich applications should have a built-in command line that matches and shows features.
Mostly they do.

ovehal

  • Participant
  • Joined in 2005
  • *
  • Posts: 16
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #18 on: December 01, 2009, 11:49 PM »
What about PSPads Search - List function? It lists all hits and let's you quickly edit the line you select in the main window...

Ove B-)

kartal

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 1,529
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #19 on: December 02, 2009, 12:15 AM »
Vim has couple scripts for search related filtering. Beside the scrips you can use gnu grep or Vim`s internal grep fro filtering lines in a new buffer. I generally use ":g -search text-" which is the easiest of all. Will show all the lines with the seach text.

emurasoft

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 10
    • View Profile
    • EmEditor (text editor)
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #20 on: November 01, 2014, 04:50 PM »
Hello,

I am Yutaka Emura, the author of EmEditor, and I have posted a few messages in this DonationCoder.com before.

Please allow me to introduce a new version of EmEditor (v14.6), which includes the Filter Bar feature that is discussed in this forum.

https://www.emeditor...ry/new-version-14-6/

With the new Filter Bar, you can view only the lines that include a specified string.

Here is the video that shows the Filter feature (watch at 1:12).




Please let me know if you have any questions or any feature requests for future versions.

Thank you!


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #21 on: November 01, 2014, 05:13 PM »
very cool  :up:

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #22 on: November 01, 2014, 06:37 PM »
As info, SPFlite does this easily (and at no cost).

The caveat is that this is a line-based text editor (it's a clone of the IBM ISPF Edit facility, for any other old mainframers). As such it doesn't behave quite like what you're used to. But for certain things, SPFLite can satisfy like nothing else. I have a copy that I fire up when I need to do things that match its strengths.

As a line-based editor, you have line numbers on the left of the display and a command line at the top. Global types of commands (Find, for example) are entered at the top, and directives for one or more lines are entered in the line number area.

Per the original request, once a file is open, at the top you could type in "x all" (to exclude all lines, hide them from sight) and then "f mailbox all" which would locate every line that contains the word "mailbox" and make it visible:

Screenshot - 11_1_2014 , 7_18_39 PM.pngText editor with filtering of lines

Any old ISPF Edit user can tell you that it can do things that are impossible in other editors. While that's probably not quite true, it makes a lot of things trivial that would take a lot of work in another editor. And there is definitely a withdrawal when you leave that environment... that's where SPFLite comes in. It is not a perfect clone, but it brings 95% of ISPF Edit and has been extended with additional features (and scripting in Basic, instead of Rexx, which I would prefer).

The free version has an innocuous nag screen that just tells you you're using the free version, and it only shows up more or less every 5th time you use the program, as you're exiting. If you donate (which I have) you get a small utility that fixes it not to display that screen.

As I said, this is not my main text editor, but it is extremely useful to have as a tool. I wish they had a "demo" script written, in the sense that you could follow the script with a sample file and see the unique things it can do.
vi vi vi - editor of the beast

motiontwelve

  • Participant
  • Joined in 2014
  • *
  • Posts: 22
    • View Profile
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #23 on: November 01, 2014, 07:25 PM »
I've tried most of the other suggestions except for EmEditor.  It almost seems like it's in a class of its own. Speechless!

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Text editor with filtering of lines
« Reply #24 on: November 01, 2014, 08:42 PM »
Please let me know if you have any questions or any feature requests for future versions.

Very nice work!

For a feature request, when using the filter bar, maybe it would be nice to be able to see some number of lines of context around each of the found items.
vi vi vi - editor of the beast