Grep like tools

21 views
Skip to first unread message

knud van eeden

unread,
Nov 20, 2009, 5:43:10 AM11/20/09
to TSEPro Support, TSEPro Support
TSE grep (available as a macro 'grep.mac' or grep.exe in the TSE directory) is one of the handiest tools for searching for text in external files.

But where I am looking for is a similar program which searches for *filenames* also in compressed files, like
.zip files
and specially
.jar
files.

Does anybody have hints or tips about any existing programs (or maybe it can maybe implemented for TSE) which can be used for searching of filenames (e.g. you want to find all filenames containing 'myfilename' in all files (including .zip files) in the c:\windows directory).

(An existing program which did the job was 'where.com' (from Keith Ledbetter), but not really available anymore as far as I know currently).

I tried http://www.wingrep.com but that did not really work at all when I tried it that version.

Any suggestions are welcomed.

Thanks,

with friendly greetings,
Knud van Eeden

The investment of buying the TSE text editor has been one of the best investments made.



knud van eeden

unread,
Nov 20, 2009, 6:25:09 AM11/20/09
to TSEPro Support, TSEPro Support
I found e.g. for TSE this similar macro
(but this does currently not search for filenames in compressed files (.zip, .jar, ...)

* Where  ("Where" on Potpourri PickList or "Where Is" under Util Menu)
  This macro searches one or more drives for files that match an indicated
  filename specification.  A PickList of all matching filenames is displayed,
  allowing you to select file(s) to edit or to delete (or on which to perform
  other available operations).
  When you execute the macro, it prompts you for the filename for which to
  search, with "Search for file:".  Following is the accepted format of the
  filename specification:
    - A complete name or an ambiguous name (with wildcard characters) can be
      specified, and can optionally include drive and/or path information.
    - Multiple filename specifications can be entered.
    - One or more drives can be specified.  If particular drive(s) are
      specified, the macro will limit the search to the indicated drive(s);
      if no drive is specified, all drives (for which the macro is configured
      to search) will be searched.  The drive(s) can be specified only as the
      beginning character(s) of the file specification entry; the indicated
      drive(s) will apply to all filename specifications that are entered.
    - If a particular directory is included in a filename specification, the
      macro will limit the search for that filename to the indicated
      directory and all of its subdirectories; if no directory is specified,
      the macro will search all directories and subdirectories of each drive
      that is searched.
  Once you enter a filename specification, the macro then searches the
  applicable drives and directories.  All matching filenames are displayed in
  a PickList.  You can select a particular file to edit or delete by
  positioning the cursor bar on that filename in the PickList, and pressing
  <Enter>.  Or you can tag multiple files (by pressing the <Spacebar> with the
  cursor bar positioned on a file) on which to operate.  The PickList is
  automatically removed once the indicated operation is performed.  Otherwise,
  to remove the PickList (and terminate the command), press <Escape>.  Or, to
  terminate the macro and release any memory used to store the PickList (if
  one exists), press <Alt X>.
  While a search is in progress, you can immediately stop the search by
  pressing <Escape>.  A PickList will be presented of those filenames that
  were located before the search was terminated.
  While the "Search for file:" prompt is displayed, a number of options are
  available:
    - To display an initial HelpScreen for the macro, press <F1>.
    - To configure several options of the macro, press <Alt C>.  You can then
      select the drives that are to be searched (when no drives are included
      in the specification entry); you can choose to add the Where macro to
      your AutoLoad List; or you can choose to remove the Where macro from
      your AutoLoad List.
    - To re-display the PickList from a previous search, press <Alt L>.
  While a PickList is displayed, other options are available:
    - To display additional HelpScreen information about other file
      operations available from the PickList, press <F1>.
    - To sort the list of entries in the PickList, press <Ctrl S>.  A pop-up
      menu allows you to select the sorting sequence.
    - To tag the file on which the cursor bar is positioned, press the
      <Spacebar>.
    - To display the entire directory containing the file on which the cursor
      bar is positioned, press <Alt L>.

Why Tea

unread,
Nov 20, 2009, 6:01:54 PM11/20/09
to SemWare
Total Commander can do the job for you. It allows you to search for
file names and grep even within packed files, then you can configure
TSE as the default editor to use. IMHO, this sort of job is better
suited for a file manager or a specialized tool.



On Nov 20, 9:43 pm, knud van eeden <knud_van_ee...@yahoo.com> wrote:
> TSE grep (available as a macro 'grep.mac' or grep.exe in the TSE directory) is one of the handiest tools for searching for text in external files.
>
> But where I am looking for is a similar program which searches for *filenames* also in compressed files, like
> .zip files
> and specially
> .jar
> files.
>
> Does anybody have hints or tips about any existing programs (or maybe it can maybe implemented for TSE) which can be used for searching of filenames (e.g. you want to find all filenames containing 'myfilename' in all files (including .zip files) in the c:\windows directory).
>
> (An existing program which did the job was 'where.com' (from Keith Ledbetter), but not really available anymore as far as I know currently).
>
> I triedhttp://www.wingrep.combut that did not really work at all when I tried it that version.

knud van eeden

unread,
Nov 20, 2009, 7:57:26 PM11/20/09
to sem...@googlegroups.com
> From: Why Tea <ytl...@gmail.com>

> Total Commander can do the job for you. It allows you to search for
> file names and grep even within packed files, then you can configure
> TSE as the default editor to use. IMHO, this sort of job is better
> suited for a file manager or a specialized tool.

I tend to run many search tools one after the other (via a serie of YesNo( "do you want to run this search program"  in a TSE macro). I choose which one is appropriate for the given search (e.g. filename search or text search).
E.g. first TSE grep, then Everything, then TSE text search, then a multibrowser search, ...
So any new solution (e.g. Peter Birch's macro) or the TSE 'where is' macro I just add to that list.

I will add TotalCommander also.
That search option was not known and never used. Great tip. Thanks.

Why Tea

unread,
Nov 21, 2009, 3:23:34 AM11/21/09
to SemWare
> I tend to run many search tools one after the other (via a serie of YesNo( "do you want to run this search program"  in a TSE macro). I choose which one is appropriate for the given search (e.g. filename search or text search).
> E.g. first TSE grep, then Everything, then TSE text search, then a multibrowser search, ...
> So any new solution (e.g. Peter Birch's macro) or the TSE 'where is' macro I just add to that list.

Wouldn't it be easier to to tie each search to a particular key
combination? Imagine you have 10 search tools :) Wouldn't those search
tools return identical results? I think text search in general can be
classified as below:

1) within a text editor (TSE in this case)
- including all files loaded in the buffers

2) search in disk files
- file name search
- grep and grep like tools
- something like Google Desktop

3) IDE type of searching
- tools that understand the meaning of the text,
e.g. computer languages
- usually requires indexing before use
- ctags, cscope for C/C++
- Source Navigator for multi-languages
- IDE such as VC, Eclipse, etc.

4) Search in packed files

5) Search text remotely (across ftp/sftp/http)

In many cases, the invocation of the programs are
in both directions, i.e.

TSE <-----> Search Tool

> I will add TotalCommander also.
> That search option was not known and never used. Great tip. Thanks.

TotalCmd does a lot more. Join its forum to learn
all the tips and tricks.

knud van eeden

unread,
Nov 21, 2009, 9:40:22 AM11/21/09
to sem...@googlegroups.com
> From: Why Tea

> Wouldn't it be easier to to tie each search to a particular key combination?

Yes, in general:

1. key: if very frequent use

2. menu: personal (search)

3. menu: job only (search)

4. macro: all (search): which shows all options serially to you, via YesNo() you select what you want more a reminder which options are available

===

> Imagine you have 10 search tools :)

At least. Searching (=usually finding answers (in a very easy way)) is one of the most important operations for me.
You tend to forget and sometimes you say hey that one comes really handy, why did I not think of that (e.g. because it is obscured in some obscure menu). If it is showed from a list that is less likely to happen. 
So I have for each major operation (=search, run, solve, ...) one macro which shows me all options from a YesNo() list as a reminder.

===

> Wouldn't those search tools return identical results?

Yes possible in some special cases, but in general maybe more not.
E.g. Google Desktop <-> Copernic desktop search <-> Yahoo X1 desktop search.
Each product has it own merits. E.g. faster <-> slower / less <-> more details / less <-> more possibilities. One maybe shows what the other does not show.
Same goes for TSE macros and other external programs.
You can then select a few best and or see all possibilities or something in between.

===

> I think text search in general can be classified as below:

Great classification. Not seen that before. Thanks for that.

  - Source Navigator for multi-languages
  - IDE such as VC, Eclipse, etc.

===

> 4) Search in packed files

At this moment:

1. Peter Birch's macro (currently until TSE v2.x only)

                                      A file find the will search the current drive
 filefin2.zip       7473   08-18-94   including zip files. All source. Works with
                                      directories nested up to 7 deep. Uploaded by:
                                      Peter Birch

2. Total Commander

3. CoolFind

4. Sun Jarscan

5. Yaworski Jarscan

===

> 5) Search text remotely (across ftp/sftp/http)

Do you know any example programs or macros for that? Thanks

> TotalCmd does a lot more. Join its forum to learn all the tips and tricks.

Absolutely.

TotalCommander (bought) is in my top list of most used tools (=TSE, Paperport, 4NT, Total Commander).

With them I do almost everything (e.g. fully automatically upload and maintenance of  websites).

TSE is the main motor / starting point / control center for that all (using a hierarchy of about 10 TSE MENUBARS -> 1000 TSE MENUs -> up to 10000 TSE macros -> possibly interacting with one or more of the 1000000 files on harddisks further otherwise local network otherwise Internet). Mouse driven (mostly) otherwise shortcut keys.

TotalCommander has so many hidden options that chances that you discover one which you did not know about are certainly there. Thanks for that again.


Why Tea

unread,
Nov 21, 2009, 9:25:03 PM11/21/09
to SemWare
On Nov 22, 1:40 am, knud van eeden <knud_van_ee...@yahoo.com> wrote:
> > 5) Search text remotely (across ftp/sftp/http)
>
> Do you know any example programs or macros for that? Thanks

Again, TotalCmd can do it natively with ftp; sftp & http
with plugins. Should probably call this VFS (virtual file
system) search.

I think it shouldn't be hard to roll your own TSE
macros with the help of cURL or wget. Finding file
names is easier but grepping will be time consuming
as you will have to get the files over and perform the
search locally. One other option is to use the remote
grep if the remote OS is Unix/Linux, and findstr if
Windows. Of course the account authority will impose
some limitations of what can be done.

I'd like to mention that the eVwFinds macro Carlo
wrote not long ago is a great enhancement to TSE's
text search capabilities.

> > TotalCmd does a lot more. Join its forum to learn all the tips and tricks.
>
> Absolutely.
>
> TotalCommander (bought) is in my top list of most used tools (=TSE, Paperport, 4NT, Total Commander).
>
> With them I do almost everything (e.g. fully automatically upload and maintenance of  websites).
>
> TSE is the main motor / starting point / control center for that all (using a hierarchy of about 10 TSE MENUBARS -> 1000 TSE MENUs -> up to 10000 TSE macros -> possibly interacting with one or more of the 1000000 files on harddisks further otherwise local network otherwise Internet). Mouse driven (mostly) otherwise shortcut keys.
>
> TotalCommander has so many hidden options that chances that you discover one which you did not know about are certainly there. Thanks for that again.

I have TotalCmd as "task distributor". TSE (plus a
few other editors) handles editing tasks. As you
probably have known, TotalCmd is quite a good program
launcher. This makes it a perfect launcher on a USB
stick for all those portable programs, including TSE.
This renders the annoying U3 unnecessary.

Although file management, program launching, etc. can
be done with TSE macros (I tried), but it's just not
the natural way to get things done. Although the TSE
interface is fine for text editing, it isn't great
for many other GUI tasks. I think TSE should only be
used for what it does best - text editing.

knud van eeden

unread,
Nov 22, 2009, 8:08:24 AM11/22/09
to tse...@freelists.org, TSEPro Support
FYI
 
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000366
 
many thanks to Peter Birch.
 
with friendly greetings,
Knud van Eeen



knud van eeden

unread,
Nov 22, 2009, 3:27:16 PM11/22/09
to tse...@freelists.org, TSEPro Support
The problem comes from this, very well known to Java programmers:

"I want to know in which .jar file my .class file is stored"

So what you do is start searching in this .jar and possibly also .zip files for '.class' filenames (e.g. 'myfilename.class').

-Grep will thus do, because filenames are by design stored verbatim in the zip or jar file.
Programs which further search in compressed files are Total Commander.
But they will not find .class files in nested .jar

But what actually is necessary to find them all is to search for filenames in *nested* .jar or .zip files.
That is a .zip in a .jar, or a .jar in a .zip, or a .zip in a .zip or a .jar in a .jar.
Or even multiple times (like a jar in a jar in a jar).
I usually have to deal with .jar in a .zip file.

FYI the only external programs which I have found doing this search for filenames in nested .jar or .zip files (that I have found until now) are:

1. -Zipscan

2. -Sun jarscan (using the -r switch)


===

Note: 

Maybe if Peter (Birch) finds it relevant, he might implement this search in (recursive) nested .zip and .jar files also in his TSE 'ff.s' macro.

That would be very nice to have.

===

In general for searching filenames on your harddisk I would like to point your attention to

 Everything'.

This is an extremely fast filename search program which shows the locations of any filename on your harddisk in *seconds*. Thus almost instantaneously. But it can not search in .zip and .jar files, and only works on NTFS volumes, but it is still one of the most versatile programs regarding file search. It is a free program.

===

Thanks

===

See also:
http://www.knudvaneeden.com/tinyurl.php?urlKey=url000368
 
---

with friendly greetings,
Knud van Eeden



Reply all
Reply to author
Forward
0 new messages