[Oberon] Re (2): Detecting whether a Text is a module source.

eas lab lab.eas at gmail.com
Sun Jan 29 19:31:00 CET 2017


> What is efficient code to find whether the word "Jaguar" is present
> in a text for example?

Efficient means minimal programming/maintenance effort,
which also entails consideration of if/how to reuse the results later?

This is a VERY common task.
eg. *nix's  [midnightCommander] the improved clone of the original DOS
nc has it as one of it's main functions.

AFAIK we had <grep> in N-O's Rx.Mod ?

In *nix I use:
 grep -n "Jaguar" <file> to get an answer WHERE it is found in the text.
Very often I want to find a string in a tree:
 grep -n <regularExpression> <DirTree>.

BTW grep is line-at-a-time based.
The regular expression is the complex part, but apparently you don't need that.

More importantly: this is another example of where one should not be writing
new code, from first principles. One should be using existing functions.
Which is where piping and functional style comes in.

BTW I use <find string/s in file/s> all the time.
I'm in M$ now, because I don't know how to get Linux to use WiFi, so I can't
look at my: cat `which Fprune`
which AFAIR prints all the files which contain <string> [the single argument],
in the present dirTree BUT not searching in *.wav, *.mp3, *.pdf.

When I go back to Linux, I'll use LEO, which can execute Linux commands,
to demonstrate what LEO can do. Unfortunately since I lost my previous system
I can only get LEO to run in DebianDVD graphic-rescue-mode. Ie. with a single
graphical terminal, like we had for N-O,

== Chris Glur.


More information about the Oberon mailing list