Text editor that does this sort of thing?

DAM

Diamond Member
Jan 10, 2000
6,102
1
76
In my line of work, there's a lot of time spent reviewing logs these logs are immense and it makes it pretty cumbersome to go through them. I'm looking for a text editor or some other software that when you do a search on a certain keyword it outputs into a separate window only those lines that have that keyword. Does that make sense?

hope someone has seen something like this.

dam()
 

AnonymouseUser

Diamond Member
May 14, 2003
9,943
107
106
Linux/Unix has "grep", which when used in conjunction with other commands does what you want. It appears to also be available on Windows - Wingrep.
 

C1

Platinum Member
Feb 21, 2008
2,386
113
106
As I recall (it's been a long time since I used it), the DOS (or command line) "FIND" command will find the text lines that contain the keyword(s). DOS FIND is still available in WINXP & probably also still in VISTA.

Yes, FIND will do what you want.
The old syntax used to be:

Find /switch "string" d:path\filename

where:

/C counts number of lines that contain "string"
/N specify the line number that contains the string
/V display all lines which do not contain "string"
/I ignore the case of the characters in "string"


Path works, but doesnt seem to do subfolders. You also have ability to search all text files in a folder/directory using wild cards. Example:

FIND /I /N "Delenn" D:\LibraryHours\*.txt

Searches all the text files in the directory LibraryHours on D drive for the string "Delenn". The display shows the file containing the text, the line number in the file containing the text and the actual line containing the text. Besides being built in, FIND works virtually instantly.

You may go to the folder/directory containing the text file(s) and issue a simpler version of the FIND command (ie, without the path portion) and also use DOSKEY to allow quick/easy repeated modification of the "string" field.

You actually can also effectively use FIND on rtf and word doc files simply by saving the file in text format or even do html by copying the text and pasting it into an editor (eg, notepad, wordpad or MS Word) and saving it as plain text.

Finally, for record keeping, you can 'pipe" the output of FIND to either a file or to a printer for hard copy. Use the old DOS syntax

Yes, all this free and already built into WINXP!

============
 

Fullmetal Chocobo

Moderator<br>Distributed Computing
Moderator
May 13, 2003
13,704
7
81
it's a simple text file you are searching? A C++ program that does this would be really easily.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,635
4,562
75
GVim will integrate with find for you.

For example, enter the command ':split', followed by ':%!find "nef"', and it will select only the lines with "nef" in them. (You should probably learn about the difference between command mode and insertion mode before trying this.)

For more precise searching, with primitive regular expressions, see also findstr.
 

Gooberlx2

Lifer
May 4, 2001
15,381
6
91
Additionally, notepad++ will do this. It opens a results pane at the bottom with only the found lines displayed. You can also "find in files" for multiple file search.
 

C1

Platinum Member
Feb 21, 2008
2,386
113
106
notepad++ is real good & I recommend getting it whether you use it or not for the purpose cited. (We use it for development work - java programming.) You'll end up using it for a lot of other reasons/uses.
 

ForumMaster

Diamond Member
Feb 24, 2005
7,792
1
0
Originally posted by: AnonymouseUser
Linux/Unix has "grep", which when used in conjunction with other commands does what you want. It appears to also be available on Windows - Wingrep.

why wingrep? there's a native win32 port of a lot of unix tools that we use a lot at the army. we also use editplus, ultra edit and notepad ++ but C1's suggestion is also nice. i'd ultra edit though. it's good for this.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,635
4,562
75
That link for unix tools doesn't include a valid download link.

Those tools are also quite old; but I don't know of a newer collection like that, except for Cygwin.

Edit: Here's one, though it's (edit2: more) complete, it includes a newer grep.

Also, did I mention findstr comes with windows? It's halfway between find and grep.