ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Windows 10, TeXLive 2016, and grep
@ 2016-08-16 19:52 Br. Samuel Springuel
  2016-08-17  8:40 ` Hans Hagen
  2016-08-20  1:08 ` Br. Samuel Springuel
  0 siblings, 2 replies; 4+ messages in thread
From: Br. Samuel Springuel @ 2016-08-16 19:52 UTC (permalink / raw)
  To: ntg-context

Where can I find the applicable documentation for the grep script 
included in TeXLive on Windows?  I.e. the one called with `mtxrun 
-script grep ...`.  In particular I'm interested in knowing which grep 
options are available and which are not.  `man mtx-grep` lists only 4 
options (pattern, count, nocomment, and xml).  Are those really the only 
options available?
-- 
✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Br. Samuel, OSB
St. Anselm’s Abbey
Washington, DC
(R. Padraic Springuel)

PAX ☧ ΧΡΙΣΤΟΣ
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Windows 10, TeXLive 2016, and grep
  2016-08-16 19:52 Windows 10, TeXLive 2016, and grep Br. Samuel Springuel
@ 2016-08-17  8:40 ` Hans Hagen
  2016-08-20  1:08 ` Br. Samuel Springuel
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2016-08-17  8:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 8/16/2016 9:52 PM, Br. Samuel Springuel wrote:
> Where can I find the applicable documentation for the grep script
> included in TeXLive on Windows?  I.e. the one called with `mtxrun
> -script grep ...`.  In particular I'm interested in knowing which grep
> options are available and which are not.  `man mtx-grep` lists only 4
> options (pattern, count, nocomment, and xml).  Are those really the only
> options available?

well, we can add more if needed .. i mostly wrote it for searching tex 
files (using the lua pattern syntax) as fast as possible

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Windows 10, TeXLive 2016, and grep
  2016-08-16 19:52 Windows 10, TeXLive 2016, and grep Br. Samuel Springuel
  2016-08-17  8:40 ` Hans Hagen
@ 2016-08-20  1:08 ` Br. Samuel Springuel
  2016-08-20 10:56   ` Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Br. Samuel Springuel @ 2016-08-20  1:08 UTC (permalink / raw)
  To: ntg-context

I'm looking particularly for the `-m #` (return only first # matches) 
and `-o` (return only the portion of the line which matches), with the 
latter being more important than the former.

I have a line in a Unix script (where I can expect standard grep to be 
available) which looks like this:

grep -m 1 'GREGORIO_VERSION' $loc | grep -o 
'[0-9]*\.[0-9]*\.[0-9]*-*[betarc]*[0-9]*' >> $OUTPUT 2>&1

Basically the script is supposed to identify which version of a file in 
our package is a person has.  To do this it looks for the first line in 
a file ($loc) which is marked as containing the version number (by 
looking for the text of the comment which we use to mark those lines for 
scripting purposes) and then extract the version number from that line 
(by looking for the pattern which the version number follows).

In Windows, I can do the first part of this command with `findstr` (a 
native command which has similar, but not identical, functionality to 
grep, but cannot do the second at all.  My current work around is to use 
the characters which precede and follow the version number to trim the 
string, but this requires me to have repetitive code because not all the 
files in our package use the same delimiting characters.  What I 
accomplish in one `for` loop in the Unix version (looping over a list of 
the files in our package), I need three loops to do in Windows (breaking 
the list up by the delimiting characters).  Having `mtxrun -script grep` 
support the `-o` option would enable me to consolidate and simplify the 
code.
-- 
✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Br. Samuel, OSB
St. Anselm’s Abbey
Washington, DC
(R. Padraic Springuel)

PAX ☧ ΧΡΙΣΤΟΣ
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Windows 10, TeXLive 2016, and grep
  2016-08-20  1:08 ` Br. Samuel Springuel
@ 2016-08-20 10:56   ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2016-08-20 10:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 8/20/2016 3:08 AM, Br. Samuel Springuel wrote:
> I'm looking particularly for the `-m #` (return only first # matches)
> and `-o` (return only the portion of the line which matches), with the
> latter being more important than the former.
>
> I have a line in a Unix script (where I can expect standard grep to be
> available) which looks like this:
>
> grep -m 1 'GREGORIO_VERSION' $loc | grep -o
> '[0-9]*\.[0-9]*\.[0-9]*-*[betarc]*[0-9]*' >> $OUTPUT 2>&1
>
> Basically the script is supposed to identify which version of a file in
> our package is a person has.  To do this it looks for the first line in
> a file ($loc) which is marked as containing the version number (by
> looking for the text of the comment which we use to mark those lines for
> scripting purposes) and then extract the version number from that line
> (by looking for the pattern which the version number follows).
>
> In Windows, I can do the first part of this command with `findstr` (a
> native command which has similar, but not identical, functionality to
> grep, but cannot do the second at all.  My current work around is to use
> the characters which precede and follow the version number to trim the
> string, but this requires me to have repetitive code because not all the
> files in our package use the same delimiting characters.  What I
> accomplish in one `for` loop in the Unix version (looping over a list of
> the files in our package), I need three loops to do in Windows (breaking
> the list up by the delimiting characters).  Having `mtxrun -script grep`
> support the `-o` option would enable me to consolidate and simplify the
> code.

I'll add -n=1 (--first) and --match

 >rgrep --pattern="modules.-%['(.-)'%]" char-*.lua --first --match

which returns (on my machine)

char-act
char-cjk
char-def
char-enc
char-ent
char-fio
char-ini
char-map
char-rep
char-tex
char-utf

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-20 10:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 19:52 Windows 10, TeXLive 2016, and grep Br. Samuel Springuel
2016-08-17  8:40 ` Hans Hagen
2016-08-20  1:08 ` Br. Samuel Springuel
2016-08-20 10:56   ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).