mrh@camcon.uucp (Mark Hughes) (05/10/88)
Has anyone had success making the recently posted GNU awk program do something useful on MS-DOS? If so, please mail me so I can find out what is wrong with this potentially indispensable program. I've compiled it using Microsoft C v5.0 easily. It required only one slight change, "#define index strchr", but refuses to work properly all the same. I mailed the original poster about this just before he posted the sources (the executable having been posted a few weeks earlier), but got no reply. I guess he thought the sources may solve the problem. So what is the problem? I am trying the most trivial awk scripts you can imagine, but gawk either fails to accept them, saying that a given regular expression is too big. For example /a string/ { print } prints any line of a file containing the text "a string" on Un*x, but gawk compiled for MS-DOS rejects it saying: "Regular expression too big". I would also like to know if other people have tried gawk out with similar results, but most of all would like to hear from anyone who has used it successfully on MS-DOS. (By the way, I have the sources to bison - GNU version of yacc, and that screws up on MS-DOS as well!) PS I'm using MS-DOS 3.2 on a (very compatible) Amstrad PC1512 and all my awk scripts have been taken from text files rather thatn being specified on a command line. -- ------------------- UUCP: mrh@camcon.uucp / ..uunet!mcvax!ukc!camcon!mrh | Mark Hughes | Telex: 265871 (MONREF G) quoting: MAG70076 |(Compware . CCL) | BT Gold: 72:MAG70076 ------------------- Teleph: Cambridge (UK) (0)223-358855
nather@ut-sally.UUCP (Ed Nather) (05/12/88)
The posted (binary) of GAWK for MS-DOS hangs my PC-XT no matter what I feed to it. I haven't yet tried compiling the source which was posted later. This is such a potentially valuable program I urge anyone who gets it to work to please let us know how you did it. -- Ed Nather Astronomy Dept, U of Texas @ Austin {allegra,ihnp4}!{noao,ut-sally}!utastro!nather nather@astro.AS.UTEXAS.EDU
trr@rayssd.ray.com (Terry R. Raymond) (05/14/88)
I could not give it a script from the command line but it works when you put the script in a file and use the -f option. I must also say that the script I used was pretty simple. { print "stuff " $1 " more stuff" } -- Terry Raymond Raytheon Submarine Signal Division; Portsmouth RI; (401)-847-8000 x5597 smart mailer or arpanet: trr@rayssd.ray.com old dumb mailer or uucp: {cbosgd,gatech,ihnp4,linus!raybed2} !rayssd!trr
tr@djinn.bellcore.com (tom reingold) (05/17/88)
In article <2347@rayssd.ray.com> trr@rayssd.ray.com (Terry R. Raymond) writes:
$
$ I could not give it a script from the command line but it works
$ when you put the script in a file and use the -f option. I must
$ also say that the script I used was pretty simple.
$
$ { print "stuff " $1 " more stuff" }
$
$ --
Try leaving a blank after the ending quote on the command line.
There must be some bug in the compiler that comiled AWK to
require this. For example,
awk "{print $1} "
And notice you need double quotes, unlike in Unix, where you need
single quotes.
"Just say NO to empty, dogmatic slogans coined by Nancy Reagan!"
Tom Reingold
PAPERNET: |INTERNET: tr@bellcore.bellcore.com
Bell Communications Research |UUCP-NET: bellcore!tr
445 South St room 2L350 |SOUNDNET: (201) 829-4622 [work],
Morristown, NJ 07960-1910 | (201) 287-2345 [home]
kadler@bbn.com (Kyle Adler) (05/21/88)
I seem to have been luckier than some netters in that I've gotten the GAWK binary (as posted) to do some useful work. The executable seems to work as advertised for string operations. However, I've had no end of problems with numeric operations. For example, the simple script "{print i++}" results in seemingly random garbage, as though the machine is trying to print the ASCII value of the integer. Forcing the variable into decimal format using "{printf("%3d\n", i++)}" seems to work for integers. Unfortunately, even printf doesn't work properly for floating point results. The script "{printf("%7.2f\n", NR/3)}" typically either prints zeroes or minus zeroes, or else hangs the machine. Has anyone else encountered these sorts of problems with GAWK under MS-DOS? This program would be indispensable if only it worked. I'm running it on an AT compatible. By the way, I've gotten the version for UNIX to compile and run successfully. Thanks for any help. -------------------------------------------------------------------------- Kyle S. Adler BBN Communications Corporation (617) 873-3009 150 CambridgePark Drive, Cambridge, MA 02115 Internet: kadler@bbn.com Usenet: {decvax,wjh12,ihnp4,harvard}!bbnccv!kadler
wheels@mks.UUCP (Gerry Wheeler) (05/21/88)
In article <2347@rayssd.ray.com>, trr@rayssd.ray.com (Terry R. Raymond) writes: > I could not give it a script from the command line but it works > when you put the script in a file and use the -f option. One of the difficulties we find when people buy our MKS Awk for DOS is that command line programs such as: awk "$3 > 0 {print $0}" somefile will fail because command.com assumes the '>' means you want to do redirection of output. In other reasonable command interpreters, you can hide the '>' from the interpreter by using the quotes. -- Gerry Wheeler Phone: (519)884-2251 Mortice Kern Systems Inc. UUCP: uunet!watmath!mks!wheels 35 King St. North BIX: join mks Waterloo, Ontario N2J 2W9 CompuServe: 73260,1043
nather@ut-sally.UUCP (Ed Nather) (05/23/88)
In article <24837@bbn.COM>, kadler@bbn.com (Kyle Adler) writes: > > I seem to have been luckier than some netters in that I've gotten the > GAWK binary (as posted) to do some useful work. The executable seems > to work as advertised for string operations. However, I've had no end > of problems with numeric operations. So have I. I got the book "The AWK Programming Language" by Aho et al. and planned to find out what worked with Gawk and what didn't, and post a summary to the net. I didn't get very far: the first example in the book, even when entered with double insted of single quotes, died a horrid death with a "null pointer assignment" diagnostic. It also managed to clobber a TSR program in memory. > For example, the simple script "{print i++}" results in seemingly > random garbage, as though the machine is trying to print the ASCII > value of the integer. Forcing the variable into decimal format using > "{printf("%3d\n", i++)}" seems to work for integers. Unfortunately, > even printf doesn't work properly for floating point results. The > script "{printf("%7.2f\n", NR/3)}" typically either prints zeroes or > minus zeroes, or else hangs the machine. > I found that *any* numeric value that I tried, using "print", would die, although some of them would work using "printf." I tried only integers. > Has anyone else encountered these sorts of problems with GAWK under > MS-DOS? This program would be indispensable if only it worked. I'm > running it on an AT compatible. By the way, I've gotten the version > for UNIX to compile and run successfully. Well, that's encouraging anyway, and suggests that perhaps the original "port" to MS-DOS was either incomplete, or a partially-ported version was inadvertantly posted instead of the working version. I agree the program would be extremely valuable if it worked. As is, it just raises the frustration level to a very high value. -- Ed Nather Astronomy Dept, U of Texas @ Austin {allegra,ihnp4}!{noao,ut-sally}!utastro!nather nather@astro.AS.UTEXAS.EDU
wheels@mks.UUCP (Gerry Wheeler) (05/25/88)
In article <454@mks.UUCP>, I wrote: > One of the difficulties we find when people buy our MKS Awk for DOS is > that command line programs such as: > > awk "$3 > 0 {print $0}" somefile > > will fail because command.com assumes the '>' means you want to do > redirection of output. I have since received mail noting that this has not been the case since version 3.1. It seems the newer versions of command.com will properly ignore '>' and '<' when placed within quotes. The same person said it would ignore '|' too, but my tests indicate otherwise. Has anybody else tried this? My test was: C> dir | egrep "DIR|foo" (using egrep from the MKS Toolkit, naturally). Command.com gave the error "bad command or file name". I presume it was trying to find and execute foo. -- Gerry Wheeler Phone: (519)884-2251 Mortice Kern Systems Inc. UUCP: uunet!watmath!mks!wheels 35 King St. North BIX: join mks Waterloo, Ontario N2J 2W9 CompuServe: 73260,1043