TSE: grep.s extended to use different grep implementations

18 views
Skip to first unread message

knud van eeden

unread,
Dec 4, 2022, 6:30:49 PM12/4/22
to SemWare TSE Pro Text Editor
Hello,

TSE grep.s has been extended to do the search instead
of using the default

TSE Semware grep.exe (located in your <TSE> installation directory)
to optionally and alternatively also do the grep using
GNU grep
Pcre2grep grep
Embarcadero BCC version 1.02 grep
Embarcadero BCC version 55 grep
Cygwin grep
MingW grep
Julia grep
Octave grep

1. To download goto
and click on the 3 dots '...' at the bottom right and select 'Download'.

2. To install unzip the file grepsemware_knud.zip in any arbitrary directory.

3. Then run the file 'zipinstallgrepsemware.bat'

4. That will re-compile the .s and .si files in that directory.

5. Make sure that sc32.exe is in your PATH, otherwise edit that .bat file and replace 'sc32' with the full path to your sc32.exe (located in your TSE installation directory), then save the file and run it again.

6. That creates thus a new grepsemware_knud.zip file.

7. Take that file and unzip it again in any arbitrary other directory).

8. Then run this TSE macro in that directory

grepsemware.mac

9. Advised is in general to save your work in TSE first.

10. This program is with regard to TSE fully stand alone thus. It can be run anywhere basically. So no dependence on LoadDir() directories, TSE mac directory, ... Because all information should be stored in one and the same directory. It does also not use tse.ini but a stand alone .ini in this directory.

11. You should backup and open the file grepsemware.ini in which you will find the different grep information in the format:

[grepsemware]
// format: comma separated list with: name of grep, TSE macro name which handles the grep output, the parameters to always add the line number + always add the filename in front, the executable filename

E.g. in each line a different grep implementation:

grep01S=tse, grepsemwaretse, , f:\wordproc\tse32_v44200\grep.exe
grep02S=gnu, grepsemwaregnu, -n -H, g:\search\regularexpression\gnu\bin\grep.exe
grep03S=pcre2grep, grepsemwarepcre2grep, -n -H, g:\search\regularexpression\pcregrep\pcre2grep.exe
grep04S=embarcaderobcc55, grepsemwareembarcaderobcc55, -n+ -o+, g:\borland\bcc55\bin\grep.exe
grep05S=embarcaderobcc102, grepsemwareembarcaderobcc102, -n+ -o+, g:\borland\bcc102\bin\grep.exe
grep06S=cygwin, grepsemwarecygwin, -n -H, g:\cygwin\bin\grep.exe
grep07S=mingw, grepsemwaremingw, -n -H, g:\language\computer\cpp\mingw\msys\1.0\bin\grep.exe
grep08S=julia, grepsemwarejulia, -n -H, g:\language\computer\julia\git\bin\grep.exe
grep09S=octave, grepsemwareoctave, -n -H, g:\language\computer\octave\octave-4.2.0-w64\bin\grep.exe

you should change the file path on your system to match that of the installation of your grep (e.g. GNU, pcre2grep, ...), backup and save the file.
---

The method used to run these different grep versions is to

a. force those different grep versions to always include line numbers in each found line

b. force those different grep versions to always include the filename in front of each line

Typical parameters for that are '-n -H' in the Unix like grep implementations.
Note that Semware TSE grep also uses this method, as it always concatenates '-n' to the search options which always includes thus line numbers. But TSE grep.s does not use the -f parameter to add also the filename in front of each line. In this version you can also use -f as parameter.

So for each grep version you convert from this format to the TSE Semware grep.s default format:

--- cut here: begin --------------------------------------------------
c:\temp\foobar1.txt:1       a
c:\temp\foobar1.txt:2       a
c:\temp\foobar1.txt:3       a
c:\temp\foobar1.txt:4       a
c:\temp\foobar2.txt:1       a
c:\temp\foobar2.txt:2       a
c:\temp\foobar2.txt:3       a
c:\temp\foobar2.txt:4       a
--- cut here: end ----------------------------------------------------
 */
 //
 // Output:
 //
 /*
--- cut here: begin --------------------------------------------------
c:\temp\foobar1.txt
1: a
2: a
3: a
4: a
c:\temp\foobar2.txt
1: a
2: a
3: a
4: a
--- cut here: end ----------------------------------------------------


Note further that you yourself will have to choose the correct search option parameters for each of the grep.

type e.g. 
grep.exe --help
or grep.exe ?
to see options.

To recursively search directories you use for most implementations e.g.
--directories=recurse
(in TSE Semware grep this has to be '-s' for example)

with friendly greetings
Knud van Eeden

knud van eeden

unread,
Dec 4, 2022, 6:35:30 PM12/4/22
to SemWare TSE Pro Text Editor
-Further is the installation of these programs

GNU grep
Pcre2grep grep
Embarcadero BCC version 1.02 grep
Embarcadero BCC version 55 grep
Cygwin grep
MingW grep
Julia grep
Octave grep

not included, so has be performed by yourself, by downloading and installing these from the Internet

So you will have to install the relevant for your grep implementations (e.g. only GNU).


-Further do you have to put the full path to TSE Semware grep.exe (located in your TSE installation directory)
in the file grepsemware.ini (see one of the first line lines where you see 'tse', replace the full path there)

Guy Rouillier

unread,
Dec 13, 2022, 3:32:52 AM12/13/22
to SemWare TSE Pro Text Editor
I've tried this macro with GNU grep, and it works well.  I'd advise switching to zip/unzip in place of PKZIP, as PKZIP is now commercial and zip/unzip is open source and available on every operating system:


The command line for zipping is simply:

zip grepsemware_knud.zip *.*

I'd like to front this with the dialog from Antos's grep and his presentation window for moving through results.  This is great start, thanks Knud.

--
Guy Rouillier
--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/semware/973612261.1089942.1670196926132%40mail.yahoo.com.

knud van eeden

unread,
Dec 13, 2022, 7:59:28 AM12/13/22
to Semware TSE Pro
Guy wrote:
> I'd advise switching to zip/unzip in place of PKZIP, as PKZIP is now commercial and zip/unzip is open source and available on every operating system:
> The command line for zipping is simply:
> zip grepsemware_knud.zip *.*

Question: Do you know where one can download the zip and unzip '.exe' for Microsoft Windows 10?

(that SourceForge web site only gives the option to download the source code it looks like at first try and searching for .exe in the unzipped directory. 

And building a .exe from scratch (e.g. from source code) is not my approach anymore, 
as that has always given issues (e.g. when using MinGW or similar) always something (library, make, ...) was missing or not working, 
so not losing time with that.

Thanks

knud van eeden

unread,
Dec 13, 2022, 8:20:13 AM12/13/22
to Semware TSE Pro
The .bat file has further been adapted to include more zip command line executables
(Winzip.exe, PKWare pkzipc.exe, RAR.exe, 7z.exe, Info-zip, ...)

See for the latest version




knud van eeden

unread,
Dec 13, 2022, 11:45:03 AM12/13/22
to Semware TSE Pro
It does not look like a good idea to pull in info-zip 'zip.exe' and 'unzip.exe'.

It looks like this is kind of not available anymore for the general user.

I have a couple of occurrences on my drive found using everything.exe (e.g. in GNUWin32,
but I downloaded the latest version of GNUWin32, but it had only unzip.exe in it, not zip.exe).

Note: Actually also TSE 'where.s' in the source code uses 'zip' for the executable to zip tagged files, but it will thus hard for the average user I assume to get hold of zip.exe.

If you know thus a good web site (many web pages links I tried not working anymore) on the Internet to download a binary 'zip.exe' would be helpful, otherwise
it is not a good idea to involve this zip.exe in TSE documentation and so on anymore probably.


S.E. Mitchell

unread,
Dec 13, 2022, 11:56:40 AM12/13/22
to sem...@googlegroups.com
https://sourceforge.net/projects/infozip/files/
That is where I got mine.
--
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/semware/464025385.5024880.1670949896287%40mail.yahoo.com.

knud van eeden

unread,
Dec 13, 2022, 12:30:19 PM12/13/22
to sem...@googlegroups.com
Thanks Sammy, but if you download the latest version


and unzip it it will show only source code (as far as I can tell now).

And that is for almost anybody, including thus the general TSE user,
on Microsoft Windows one bridge too far (e.g. compiling from source code).


> To unsubscribe from this group and stop receiving emails from it, send an email to semware+unsub...@googlegroups.com.
--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+unsub...@googlegroups.com.

S.E. Mitchell

unread,
Dec 13, 2022, 1:15:28 PM12/13/22
to sem...@googlegroups.com
Oops - sorry about that.
I wonder why they no longer post the newest binaries?
They are opensource, so you could get the latest and host them.
I found them here (where I get one of the gcc versions I use):
https://www.willus.com/archive/zip64/
and here:
http://stahlworks.com/zip
--

On Tue, Dec 13, 2022 at 12:30 PM 'knud van eeden' via SemWare TSE Pro
> > To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/semware/464025385.5024880.1670949896287%40mail.yahoo.com.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/semware/832234422.3825130.1670952617281%40mail.yahoo.com.

knud van eeden

unread,
Dec 13, 2022, 2:27:29 PM12/13/22
to sem...@googlegroups.com
1. The first Willus web site my security program did not like, so skipped that.

2. The second web site Stahlworks had this message:

  • the very latest versions would be zip 3.1 and unzip 6.10. these are Betas, official binaries were never released by Info-Zip. here are binaries compiled by stahlworks.com, from the original sources provided on the Info-Zip sourceforge site.these versions come with full UTF-8 unicode support, but are not fully tested. As of 2018, the original Info-Zip.org website seems offline, but you may check their sourceforge site for further informations.

---

But you use in where.s e.g. '@' as parameter, that looks like a zip.exe only parameter for now.

So we would have to go with the beta version I guess to use e.g. with TSE 'where.s' to zip tagged filenames in a zip file.

I plan to test that some time, but in my version of where.s (2002) the zip option is not present (I had to roll back to an older version because where.s has an issue in the 
latest TSE versions) so I will wait until the new where.s version in 4.49.

One can otherwise e.g. use RAR, 7z, GNU, Cygwin, ... as a free version alternative. I would probably go for the Cygwin version then (e.g. unzip.exe (that is actually also info-zip unzip.exe version 6.00 I see now when checking in Cygwin) and gzip.exe).

Cygwin has an unzip.exe and zip.exe thus. But it requires 64 bits installation. My Cygwin version at this moment is still 32 bits, because I had to rollback an update a while ago because of issues. Altogether Cygwin is the best choice thus probably, e.g. as it is a trusted source, robust, industry level hardened and actively maintained.

See also:


> > To unsubscribe from this group and stop receiving emails from it, send an email to semware+unsub...@googlegroups.com.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+unsub...@googlegroups.com.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+unsub...@googlegroups.com.
--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+unsub...@googlegroups.com.

knud van eeden

unread,
Dec 13, 2022, 2:53:27 PM12/13/22
to sem...@googlegroups.com
OK, I installed a separate Cygwin 64 bits, choose 'unzip' and 'zip' in the list of programs to install. 

That gave for unzip

g:\cygwin64\bin Tue 13-12-22 20:50:35>unzip.exe
UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

and zip

g:\cygwin64\bin Tue 13-12-22 20:50:41>zip.exe
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:

So that is probably the best choice to get a more recent info-zip version.



knud van eeden

unread,
Dec 13, 2022, 3:12:43 PM12/13/22
to sem...@googlegroups.com
I would further remark that 'zip' and 'unzip' are rather not well-known programs as far as I know.

I can not recall having ever heard about it before.

In Linux / Unix one typically uses 'tar'

Further maybe 'gzip' (which is GNU zip)




Guy Rouillier

unread,
Dec 13, 2022, 8:49:09 PM12/13/22
to Semware TSE Pro
That's really strange.  I certainly didn't expend a lot of effort to get the InfoZip binaries many years ago.  I don't know why they are not available on the SourceForge site any longer.

At any rate, I found some on the InfoZip FTP site listed in unzip -v: 


Neither Firefox or Chrome will open FTP sites any longer :(, so I had to use FileZilla.  I did a search for "infozip binaries", and found these two sites:


I'd suggest using these, as they have more up-to-date builds than even the InfoZip FTP site.  Having found these, I'm going to switch to 64-bit builds for my own system now.

--
Guy Rouillier
--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages