Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where can I get a copy of awkc or any version of awk that can compile an awk script?

689 views
Skip to first unread message

Joe Huang

unread,
Dec 9, 2013, 3:23:12 AM12/9/13
to
I've been writing awk scripts for over 20 years, but I've found it increasingly difficult to share my awk scripts with others, since it requires having awk installed on their machine and some minimal knowledge of writing unix syntax command lines. I've read on the Web that there are versions of awk, esp. awkc, that can compile an awk script into an executable program. Does anyone know or have any recommendations on where I can find such a program? I'm now doing everything on a PC using Windows 7. Thanks for any info.

Janis Papanagnou

unread,
Dec 9, 2013, 3:44:06 AM12/9/13
to
On 09.12.2013 09:23, Joe Huang wrote:
> I've been writing awk scripts for over 20 years, but I've found it
> increasingly difficult to share my awk scripts with others, since it
> requires having awk installed on their machine and some minimal knowledge
> of writing unix syntax command lines.

Well, to start a program from a shell, or bat or cmd interpreter, should
not be a problem as long as your scripts are self-contained as it seems.
(Are you aiming at programs started by clicke-di-clicke-di-click GUI?)

> I've read on the Web that there are
> versions of awk, esp. awkc, that can compile an awk script into an
> executable program.

You could distribute the gawk.exe together with your scripts.

> Does anyone know or have any recommendations on where
> I can find such a program?

How about doing a Google search? (Works for me.)

Janis

Aharon Robbins

unread,
Dec 9, 2013, 1:00:08 PM12/9/13
to
In article <a5f24c71-d152-45d7...@googlegroups.com>,
Please see https://groups.google.com/forum/#!topic/comp.lang.awk/fWkpVz-K-Us
which in turn points to

https://open-innovation.alcatel-lucent.com/projects/awkcc

You may be able to make use of this.

Good luck,

Arnold
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381
Nof Ayalon
D.N. Shimshon 9978500 ISRAEL

Joe Huang

unread,
Dec 9, 2013, 4:40:48 PM12/9/13
to
On Monday, December 9, 2013 12:44:06 AM UTC-8, Janis Papanagnou wrote:
> On 09.12.2013 09:23, Joe Huang wrote:
>
> > I've been writing awk scripts for over 20 years, but I've found it
>
> > increasingly difficult to share my awk scripts with others, since it
>
> > requires having awk installed on their machine and some minimal knowledge
>
> > of writing unix syntax command lines.
>
>
>
> Well, to start a program from a shell, or bat or cmd interpreter, should
>
> not be a problem as long as your scripts are self-contained as it seems.
>
> (Are you aiming at programs started by clicke-di-clicke-di-click GUI?)

Yes. The problem is not for me, since I always run my awk scripts from a command line box, but for others, who seem increasingly wedded to Windows OS
and know only to click on icons. Not sure why you wrote "clicke-di-clicke-di-click", except to mock...
>
>
>
> > I've read on the Web that there are
>
> > versions of awk, esp. awkc, that can compile an awk script into an
>
> > executable program.
>
>
>
> You could distribute the gawk.exe together with your scripts.
>
That's what I have been doing, but it seems burdensome to explain to those unfamiliar with command line operations.
>
>
> > Does anyone know or have any recommendations on where
>
> > I can find such a program?
>
>
>
> How about doing a Google search? (Works for me.)

Do you always write in such mocking tones? I only posted my question because I could only find mention of awkc on the Web, but no links to downloadable or purchasable copies, except as part of an entire Developer Kit.

Joe Huang

unread,
Dec 9, 2013, 4:49:32 PM12/9/13
to
On Monday, December 9, 2013 10:00:08 AM UTC-8, Aharon Robbins wrote:
> In article <a5f24c71-d152-45d7...@googlegroups.com>,
>
> Joe Huang wrote:
>
> >I've been writing awk scripts for over 20 years, but I've found it
>
> >increasingly difficult to share my awk scripts with others, since it
>
> >requires having awk installed on their machine and some minimal
>
> >knowledge of writing unix syntax command lines. I've read on the Web
>
> >that there are versions of awk, esp. awkc, that can compile an awk
>
> >script into an executable program. Does anyone know or have any
>
> >recommendations on where I can find such a program? I'm now doing
>
> >everything on a PC using Windows 7. Thanks for any info.
>
>
>
> Please see https://groups.google.com/forum/#!topic/comp.lang.awk/fWkpVz-K-Us
>
> which in turn points to
>
>
>
> https://open-innovation.alcatel-lucent.com/projects/awkcc
>
>
The first link worked, but not the second. Anyway, I was able to get to the awkcc page, but not sure that's what I need. From what I can tell, awkcc converts awk scripts to c code, which can then be compiled into a c executable.
The awkcc download also reads like it's source code in c, which also has to be compiled to create an awkcc executable. This is getting more convoluted than what I had bargained. I thought awkc would be a one-shot solution going from awk script to executable. Also, is everything in alcatel-lucent.com strictly for unix? Didn't want to get into Unix2DOS conversion problems, either.

Janis Papanagnou

unread,
Dec 9, 2013, 5:19:37 PM12/9/13
to
On 09.12.2013 22:40, Joe Huang wrote:
> On Monday, December 9, 2013 12:44:06 AM UTC-8, Janis Papanagnou wrote:
>> On 09.12.2013 09:23, Joe Huang wrote:
>>
>>> I've been writing awk scripts for over 20 years, but I've found it
>>
>>> increasingly difficult to share my awk scripts with others, since it
>>
>>> requires having awk installed on their machine and some minimal
>>> knowledge
>>
>>> of writing unix syntax command lines.
>>
>>
>>
>> Well, to start a program from a shell, or bat or cmd interpreter, should
>>
>> not be a problem as long as your scripts are self-contained as it seems.
>>
>> (Are you aiming at programs started by clicke-di-clicke-di-click GUI?)
>
> Yes. The problem is not for me, since I always run my awk scripts from a
> command line box, but for others, who seem increasingly wedded to Windows
> OS and know only to click on icons. Not sure why you wrote
> "clicke-di-clicke-di-click", except to mock...

Yes, exactly; just to mock.

>>
>>
>>
>>> I've read on the Web that there are
>>
>>> versions of awk, esp. awkc, that can compile an awk script into an
>>
>>> executable program.
>>
>>
>>
>> You could distribute the gawk.exe together with your scripts.
>>
> That's what I have been doing, but it seems burdensome to explain to those
> unfamiliar with command line operations.

But you can register applications in WinDOS to start the awk interpreter
on the clicked file, don't you?

(Yes, the term "WinDOS" was also just mocking.)

>>
>>
>>> Does anyone know or have any recommendations on where
>>
>>> I can find such a program?
>>
>>
>>
>> How about doing a Google search? (Works for me.)
>
> Do you always write in such mocking tones?

Usually only in cases where I have got the impression that the poster
spent not the least effort to look that up himself. As said, it works
for me; I got immediately on the first few links relevant information.
(Thirty seconds effort, much less time than to post a question, or to
write a reply.)

> I only posted my question
> because I could only find mention of awkc on the Web, but no links to
> downloadable or purchasable copies, except as part of an entire Developer
> Kit.

To not leave you completely frustrated I'd like to point you to awka
(http://awka.sourceforge.net/index.html); this is an awk compiler
that had been developed 10+ years ago[*]; it *may* serve your porpose
anyway.

Janis

[*] But to my knowledge, it isn't supported anymore, and newer WinDOS
versions are not yet mentioned, so it may or may not compile on you
system.

Bruce Horrocks

unread,
Dec 10, 2013, 4:11:49 PM12/10/13
to
Not quite what you ask for but what if your users could drag and drop
the text file to be processed onto a file which then runs awk for them?
Would that be good enough?

If so then build a zip file containing:
- a standalone awk.exe
- your awk script as the file "your_script.awk"
- the file below saved as "drop_here.vbs"

Distribute the zip file; tell the recipients to unzip it to a directory
and open the directory in Windows Explorer; then drag and drop the text
file to be processed onto the "drop_here.vbs" file.

The vbs file is VBscript which is built into XP & Win7. It will execute
when a file is dropped on it, building and executing a Windows command
line that invokes the awk.exe delivered with the zip file. If you're
already explaining to your users how to build a windows command line
then I'm sure you'll be able to work out what it is doing.

Save the following between the begin and end lines as "drop_here.vbs"
(i.e. a plain text file with .vbs instead of .txt as the extension).

---begin---
' Run an Awk script against the dropped file
set fso = CreateObject("Scripting.FileSystemObject")
curr_dir = fso.GetParentFolderName(WScript.ScriptFullName)
set wsh_shell = CreateObject("WScript.Shell")
wsh_shell.CurrentDirectory = curr_dir
awk_cmd = "awk.exe -f your_script.awk"
args = WScript.Arguments.Count
if args > 0 then
for i = 0 to args - 1
fname = WScript.Arguments.item(i)
awk_cmd = awk_cmd & " " & chr(34) & fname & chr(34)
next
wsh_shell.Run("cmd /K " & awk_cmd & " > output_file.txt")
else
msgbox "Please drop a text file onto this icon to process it"
end if
---end---


--
Bruce Horrocks
Surrey
England
(bruce at scorecrow dot com)

Kenny McCormack

unread,
Dec 11, 2013, 6:31:47 AM12/11/13
to
In article <a5f24c71-d152-45d7...@googlegroups.com>,
It sounds to me like you're not really looking for an AWK compiler, per se.
That is, you're not looking for a compiler in either of the usual contexts
of why people ask for compilers for scripting languages, namely:

1) Speed (performance)
or 2) Encryption (hiding their source code)

Rather, you seem to be looking for a "wrapper" - that is, something that
will make it easier for a poor, befuddled, Windows user to run your
program. This need not be (and, in fact, probably shouldn't be) written in
AWK, but rather in some native-to-windows programming language.

Another poster has suggested VBScript. Along those lines, you could also
try VB.net or any other .NET thingie. Or Powershell. These things all
have the advantage that they are supplied by Microsoft, and are (more or
less) "built-in" to Windows these days. Unfortunately, both of these
"advantages" are also disadvantages. Such is life...

I would like to suggest WinBatch (www.winbatch.com), which I have been
using for (literally) decades and (obviously) like very much. It's not
free (in fact, far from it - the full package, which you will need to
produce turnkey/totally-self-contained user-deliverables, is 5 bills, but
it is well worth it [*]), but it does everything you need and (IMHO) in a
much more pleasing way than the aforementioned Microsoft products do.

[*] You, as the developer, need to purchase the full product. There is no
cost to your users.

--
To most Christians, the Bible is like a software license. Nobody
actually reads it. They just scroll to the bottom and click "I agree."

- author unknown -

Kaz Kylheku

unread,
Dec 17, 2013, 8:13:18 PM12/17/13
to
On 2013-12-09, Joe Huang <yjh...@gmail.com> wrote:
> I've been writing awk scripts for over 20 years, but I've found it
> increasingly difficult to share my awk scripts with others, since it requires
> having awk installed on their machine and some minimal knowledge of writing
> unix syntax command lines.

If you're not actually after optimization, then a file with #!/bin/awk -f
at the top is an executable.

awk is a POSIX standard utility; why don't people have it on their system?

If you're talking windows, then make an installer which includes everything
that is needed to run, including awk executables. E.g. NSIS (Nullsoft
Installer System).

> I've read on the Web that there are versions of
> awk, esp. awkc, that can compile an awk script into an executable program.

If all you want is to bundle a script with an interpreter, there are
other ways. Take the GNU Awk source code and produce an executable which
contains your script as a static character string, and is hacked to
execute that string instead of processing arguments the normal way.

There is no need to actually compile the code to get the standalone
packaging.

There are tricks for generalizing this sort of thing, allowing you
to just catenate an executable and a script. The executable
finds its own path, and reads the script from an offset in the
file or whatever.

--
ADA MP-1 Mailing List: http://www.kylheku.com/mp1

Aharon Robbins

unread,
Dec 17, 2013, 11:17:46 PM12/17/13
to
In article <201312171...@kylheku.com>,
Kaz Kylheku <k...@kylheku.com> wrote:
>If all you want is to bundle a script with an interpreter, there are
>other ways. Take the GNU Awk source code and produce an executable which
>contains your script as a static character string, and is hacked to
>execute that string instead of processing arguments the normal way.

Doing this requires distributing the full source for both the awk
program and GNU Awk. Just as a point that should not be forgotten.
0 new messages