Re: Automatisierte TextVerarbeitung




"Jo" <dummy_1943@xxxxxxx> schrieb im Newsbeitrag
news:1149495880.450989.100100@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scheibenkleister !!
AWK - oder bessergesagt "awk" kam mir doch gleich irgendwie bekannt vor
..

..nach meinem Dafürhalten ist das keine SkriptSprache, sondern einfach
ein, bei der BourneShell, integrietes Programm.

Wenn Du also einen URL zu einer AWK-Version für Windows hast, melde

AWK ist eine Skriptsprache und gehoert zur Standardausruestung von UNIX und
Linux
und wird somit staendig in jeder shell (bourne, ksh, c-shell, ... genutzt).

Es gibt viele Varianten : awk, nawk mawk, gawk (GNU),...
Einige kann man auch als exe fuer Windows beziehen (laufen in dos-box)
Ich werde Die ein paar Links unten beifuegen.

Die Doku nimmt man am besten von der entsprechenden Distribution.
Der Anfang wird ein bisschen schwierig sein, weil einfuehrende Worte fehlen.
Wenn erforderlich schreibe ich Dir hierzu ein paar Absaetze zusammen.

Ich habe soeben ein altes mawk herausgekramt und ein mini-awk script, direkt
in die Command-Line geschrieben ausprobiert.
Siehe Test.bat und hierzu ein zu bearbeitendes Input-File Test.txt :

Test.bat :
cd \Dokumente und Einstellungen\Jo\Eigene Dateien\Freeware\mawk
mawk.exe "{print $2}" TEST.txt
pause

TEST.txt :
abc def ghi
jkl mn op
q rst uvw
fin ito

Wichtiger Hinweis : Unter Unix schreibt man das "awk-script", soferne es
direkt in der Commandline steht, unter einfachen
Hochkommas, unter Dos muessen es doppelte Hochkommas sein, wodurch man
Probleme mit Strings hat.

Hierzu ein Beispiel ( aus test.bat )
mawk.exe "{print $2}" TEST.txt
oder man schreibt das Script in ein eigenes File und ruft es dann so auf :
mawk.exe -f mein-awk-script TEST.txt

mein-awk-script beinhaltet hier dann nur :
{print $2}

Hinweis :
awk zerlegt jede Input-Zeile in einzelne Felder ($1, ...). Das Trennzeichen
(per Default "white-space") kann geaendert werden.
z.B.: mawk.exe -F":" -f .... hier ist dann der Doppelpunkt der
Delimiter.

Fuer Dich waere Nachfolgendes Script ev. ein besseres Beispiel :
{s=$0; sub(/^.*<a href=\"/,"",s); sub(</a>.*$,"",s); print s}
Legende :
$0 iste die ganze Inputzeile.
Unter der Annahme, dass im HTML-File, Hyperlinks immer komplett in einer
Zeile stehen,
und dass immer nur ein Link in einer Zeile steht, wuerde obiges Script aus
z.B.:
..........<a href="eine-url">klick-mich</a>.......
Nachfolgendes extrahieren :
eine-url">klick-mich
Einweiters sub koennte dann ein CSV-File erstellen :
sub(/\">/,",",s)
sub substituiert den String, welche die regular-expression /.../
beschreibt durch den String "" ( also durch nix ).
Manche Zeichen muessen "escaped" werden : z.B.: Doppeltes Hochkomme
(BackSlash vorranstellen) und natuerlich Backslash.
Eine Regular-Expression wird hier immmer zwische 2 Slash geschrieben.


#---
Hier noch ein paar Links (ungeprueft, habe ich irgendwann gesammelt) :


Von: "Larry__Weiss" <lfw@xxxxxxxxxxx>
Betreff: Re: where are the binaries for GAWK ?
Datum: Dienstag, 07. Oktober 2003 15:54

Bill Marcum wrote:
On Tue, 07 Oct 2003 00:03:20 -0500, Larry__Weiss
<lfw@xxxxxxxxxxx> wrote:
I used to be able to download ready-to-run versions of GAWK from
sites like:
ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish/gawk303x.zip
This collection is not available there anymore.
Does anyone know if it is still available anywhere else?


Try delorie.com? That site should have the binary and the DJGPP
compiler to build your own.


Thanks! http://www.delorie.com/pub/djgpp/current/v2gnu/gwk311b.zip

was available there.

- Larry Weiss
On Tue, 07 Oct 2003 00:03:20 -0500, Larry__Weiss
<lfw@xxxxxxxxxxx> wrote:

I used to be able to download ready-to-run versions of GAWK from
sites like:

ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish/gawk303x.zip

This collection is not available there anymore.

Does anyone know if it is still available anywhere else?

Try delorie.com? That site should have the binary and the DJGPP
compiler to build your own.

--
Cheops' Law:
Nothing ever gets built on schedule or within budget.

I used to be able to download ready-to-run versions of GAWK from
sites like:

ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish/gawk303x.zip

This collection is not available there anymore.

Does anyone know if it is still available anywhere else?

Thanks! - Larry Weiss
#---
Von: "Larry__Weiss" <lfw@xxxxxxxxxxx>
Betreff: Re: Where can I download 32-bit awk for Windows 2000?
Datum: Dienstag, 07. Oktober 2003 17:37

L Zhou wrote:
I searched the net and I could not find any already built image. A
link would be greatly appreciated. Thanks.

Try

http://www.delorie.com/pub/djgpp/current/v2gnu/gwk311b.zip
#---
Von: "Olaf Schoenfeldt" <may2003@xxxxxxxxxxxxx>
Betreff: Performance-optimized mawk for Win32 available
Datum: Mittwoch, 07. Mai 2003 07:15

Hello NG,
I have made some tests using Dr. Michael Brennan's (old) sources of
mawk1.3.3 for looking for the fastest awk interpreter at Win32.

Using the free distribution of Borland C/C++ 5.5 (command line version
only) with compiling option -O2 for optimiziation gives good results
and needs only a few small modifications for getting rid of compiling
errors.
Additionally I have built in a small usage message (in a similar way
like gawk is using it) that informs about the most familiar options of
mawk.
It is generated if mawk.exe is invoked without any parameter.

Additionally the executable file mawk.exe was exe-compressed with UPX.

The result is remarkably faster than gawk.exe at Windows 32 bit and
offers also a better performance than the pre-compiled Linux version
of mawk which can be found in most distributions.

You can find a description and also the download link at
http://www.klabaster.com/freewar1.htm

or you can download it directly:
including "The AWK Manual" Edition 1.0:
http://www.klabaster.com/progs/mawk32.zip (146 kByte)

otherwise:
http://www.klabaster.com/progs/mawk32n.zip (79 kByte)
#---


.



Relevant Pages

  • Re: Need help correcting this Bash function
    ... >> Why is it better to write a bash script than a script that runs ... machines that don't have bash or other more recent shells installed and, ... I do use gawk instead of old awk. ...
    (comp.unix.shell)
  • Re: Executable awk script
    ... >>> Is there a way to turn a awk script into an executable so that you do ... >> Bill Seivert ... >But who in their right mind would use gawk on Windows? ... between XP and Linux (the trick is to make the script file have Unix ...
    (comp.lang.awk)
  • Re: Geez - is Solaris /usr/bin/awk brain dead or what?
    ... >which you might want to test on your old script. ... gawk's --traditional option makes gawk support some of the stuff that ... The V7 awk did not. ...
    (comp.unix.solaris)
  • Re: alternatives to awk
    ... I need to create scripts in Windows hosted QNX Momentics. ... Why do you need an alternative to the AWK language? ...
    (comp.lang.awk)
  • Re: Difference beetwen awk and gawk?
    ... I'm new to awk, I wrote a simple script using gawk, then change it to awk: ... 0602-533 Cannot find or open file afile.dat ...
    (comp.lang.awk)