Some 5 years ago or so I used to have a c file with some very good
implementation of awk funktions like split() and sub() and such. I
think it was named awklib.c. Now I would have REALLY good use for those
functions again and I wonder if someone knows where I can find that
source file again? I don't know where I put my copy...
Regards,
/Peter Strömberg
-= Spam safe(?) e-mail address: pez68 at netscape.net =-
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
You are not the only one. I was in the exact same condition -- minus the
grave necessity to use it, thankfully.
You are referring to the awk compiler and library distributed by
(IIRC) Bell Labs, and you are correct that this distribution is
indeed defunct. However, not to disappoint you entirely I can
direct you to the awk FAQ (http://www.faqs.org/faqs/computer-lang/awk/faq/)
and this resource will echo our frustration but provides for some
alternative awk "compilers".
http://www.unipress.com/att/new/awkcc.html (commercial)
BTW, did you know that awk has _always_ been a compiler? The
undocumented options -R and -S enable preparsing and image store
of the awk source; the image is not formally a compilation because
awk(1) is still necessary to execute it, but no parsing stage is
necessary -- with a few caveats. Here are my notes on this feature:
Note that this is not implemented (broken or not) in gawk or other
awk clones.
Script "Compilation"
The command
awk -S -f script.awk
produces a file named awk.out. This is a core image of awk
after parsing the file script.awk. The command
awk -Rawk.out datafile
causes awk.out to be applied to datafile (or the standard
input if no input file is given). This avoids having to
reparse large scripts each time they are used. Unfortu-
nately, the way this is implemented requires some special
action on the part of the person installing awk.
As awk is delivered with 4.2 BSD (and 4.3 BSD), awk.out is
created by the awk -S ... process by calling sbrk() with
'0', writing out the returned value, then writing out the
core image from location 0 to the returned address. The awk
-R... process reads the first word of awk.out to get the
length of the image, calls brk() with that length, and then
reads the image into itself starting at location 0. For
this to work, awk must have been loaded with its text seg-
ment writeable. Unfortunately, the BSD default for ld is to
load with the text read-only and shareable. Thus, the
installer must remember to take special action (e.g. "cc -N
Also, due to what appears to be a lapse in logic, the first
non-flag argument following -Rawk.out is discarded.
Would you do me the favor of emailing me when you have (or not) a
solution? I would be curious to know the outcome.
-Brian
http://www.linuxstart.com/~awka/
-Brian
Thanks for this info. Though I know I am not referring to the awk
compiler. The awklib.c I had was a tiny file with some c funtctions
that were named after their awk counterparts. I could compile and link
this library with my othe c code and have surprisingly much of awk
power available. The file was maybe 10k in size at the very most. I
tweeked my copy of it some so I could compile a Windows DLL that I used
from my Delphi projects. It was great. Now I didn't take as good care
about the file as I should have, but how was I to know that the little
file should dissapear from the face of the earth?
> BTW, did you know that awk has _always_ been a compiler? The
> undocumented options -R and -S enable preparsing and image store
> of the awk source; the image is not formally a compilation because
> awk(1) is still necessary to execute it, but no parsing stage is
> necessary -- with a few caveats. Here are my notes on this feature:
> Note that this is not implemented (broken or not) in gawk or other
> awk clones.
>
> Script "Compilation"
>
> The command
>
> awk -S -f script.awk
>
> produces a file named awk.out. This is a core image of awk
> after parsing the file script.awk. The command
>
> awk -Rawk.out datafile
[snip]
I had absolutely no idea what so ever! Thanks Brian for this info. Even
if I don't have much practical use for it, Curious George within just
loved to know! I will check my awks out to see it work.
I'll take the opportunity to again ask if someone has seen this
awklib.c file around? I'd love to get my hands on it again.
/Peter
--
-= Spam safe(?) e-mail address: pez68 at netscape.net =-
Sent via Deja.com http://www.deja.com/
Before you buy.
I could only find a reference to the library awklib.c in a document
without a URL to find the source by doing a 'net search via AltaVista.
PEZ, if you're interested I could send you my non-RE gsub() and sub().
Peter
--
Peter S Tillier pet...@eq1152.demon.co.uk
Peter....@BTinternet.com
Fax2Email 0870 052 2717
Opinions expressed are my own and not necessarily those of my employer.
You might also want to check out section 6.8 of the awk FAQ, which
mentions the Awka project being done by Andrew Sumner,
<mailto:andrew...@bigfoot.com>, though the url in the FAQ is now
redirected to <http://www.linuxstart.com/~awka/index.html>. His code
is still in beta, but he has what looks like a reasonable approach to
licensing of the library he's developing there.
----------------------------------------------------
Peter J. Farley III (pjfa...@nospam.dorsai.org OR
pjfa...@nospam.banet.net)
I really meant section 6.9, of course. Sorry for the typo.
I have concidered using the gnu regexp library, but it's such a biggy
solution for a small problem. And I would have to write my own awk-ish
sub(), split(), etc. That was what was so neat about this awklib.c
library. Smallish and efficient. It had two variants of split(), sub()
and the lot. One that would take a precompiled RE and one that would
compile a RE on the fly.
> I could only find a reference to the library awklib.c in a document
> without a URL to find the source by doing a 'net search via AltaVista.
Yes, I found that one too. Frustrating.
> PEZ, if you're interested I could send you my non-RE gsub() and sub().
Yes, please do. A straight string search is great for many tasks.
Regards,
Is this what you are looking for?:
/*
* awklib.c - C callable routines that provide field splitting and regular
* expression matching functions much like those found in AWK.
*
* Copyright 1988, Jim Mischel. All rights reserved.
*/
If so then you can find it at
ftp://ftp.ceu.fi.udc.es/development/c/msdos/awklib.rar
Hope this helps,
Greg.
brian hiles <b...@rainey.blueneptune.com> wrote in article
<s0cpf5...@corp.supernews.com>...
> PEZ <pe...@my-deja.com> wrote:
> > Some 5 years ago or so I used to have a c file with some very good
> > implementation of awk funktions like split() and sub() and such. I
> > think it was named awklib.c. Now I would have REALLY good use for those
> > functions again and I wonder if someone knows where I can find that
> > source file again? I don't know where I put my copy...
>
Sorry for off-topic, but it is relevant to "awklib.rar"
Sam
Regards
Sa,
Probably a typo. The letter "r" is right next to "t" on the
keyboard. I didn't check the URL.
Chuck Demas
Needham, Mass.
--
Eat Healthy | _ _ | Nothing would be done at all,
Stay Fit | @ @ | If a man waited to do it so well,
Die Anyway | v | That no one could find fault with it.
de...@tiac.net | \___/ | http://www.tiac.net/users/demas
> Probably a typo. The letter "r" is right next to "t" on the
> keyboard. I didn't check the URL.
well, unfortunately, .rar is yet another file compression ``standard'',
this one popular in DOS. it is very similar in use to DOS arj.
IIRC, I have seen *nix utilities to deal with it, but not sure.
HTH.
Colin DeVilbiss
crde...@mtu.edu
I just checked the URL, and it isn't a typo.
Live and learn. :-)
http://www.physics.ubc.ca/~blok/download/awklib.zip
- Rik.
Sam Hobbs wrote:
>
> OK, I know this must be naive, but what is an "rar" file extension. I've run
> across tar, shar, gz, zip BUT to date not rar and it is difficult to decode
> without a little more info.
>
> Sorry for off-topic, but it is relevant to "awklib.rar"
> Sam
--
Rik Blok <bl...@physics.ubc.ca>
Department of Physics and Astronomy,
University of British Columbia, Canada
http://www.physics.ubc.ca/~blok/
Sandy
> IIRC, I have seen *nix utilities to deal with it, but not sure.
>
> HTH.
>
> Colin DeVilbiss
> crde...@mtu.edu
>
Indeed YES!!!!!
> Hope this helps,
You bet it did! Thanks a bunch!