Command line length - awk on a PC 
Author Message
 Command line length - awk on a PC

I can only get three data files on the awk command line under MS Dos (Win
98) before the line gets truncated.  Is there a way in which the command
line can be extended, or an alternative method reading the data files which
is not subject to this limitaion?


Fri, 09 Aug 2002 03:00:00 GMT  
 Command line length - awk on a PC
I had the same problem.  It seems DOS only supports 127 (or was it 255?)
chars on the command line.  A work around is to use a bash shell for
DJGPP which supports long command lines, like...

        ftp://ftp.cdrom.com/.3/simtelnet/gnu/djgpp/v2gnu/bsh1147b.zip

I run gawk with the following script:


rem If parameters not already set...
if not "%AWKPATH%"=="" goto run
rem ...then set them now.
set PATH=C:\Progra~1\Gnu\Bin;%PATH%
set HISTFILE="C:\Program Files\Gnu\Bin\.bash_history"
set TMPDIR=%TEMP%
set AWKPATH=.;C:/Program Files/Gnu/lib/awk;C:/My Documents/Awk/Library
goto run

:run
bash igawk %1 %2 %3 %4 %5 %6 %7 %8 %9
------ end igawk.bat ------

Hope that helps!
- Rik.

Quote:

> I can only get three data files on the awk command line under MS Dos (Win
> 98) before the line gets truncated.  Is there a way in which the command
> line can be extended, or an alternative method reading the data files which
> is not subject to this limitaion?

--

Department of Physics and Astronomy,
University of British Columbia, Canada
http://www.physics.ubc.ca/~blok/


Sat, 10 Aug 2002 03:00:00 GMT  
 Command line length - awk on a PC
On Mon, 21 Feb 2000 13:47:51 -0000, "Jon Aldews"

Quote:

>I can only get three data files on the awk command line under MS Dos (Win
>98) before the line gets truncated.  Is there a way in which the command
>line can be extended, or an alternative method reading the data files which
>is not subject to this limitaion?

gawk-w32.exe v3.0.3 in a DOS-box under Windows 95 uses the
environment variable %CMDLINE%, I don't know what its limits
are, but I frequently have commands of 400 chars or more,
representing something like 30 filenames. I think previous
versions of awk / gawk didn't always support that.

No I don't type those 400+ chars by hand, they are composed in
an AWK.BAT procedure that provides wild card expansion.

I type :
        awk debug s\a*.awk tmp.txt

The awk.bat procedure has the line :
        %U%\gawk-w32.exe -f lib.awk -f a%1.awk%XX% >>%O%

        (%XX% is filled with a "for %%v in (%2) " construct.)

Which expands to:
        c:\bin\dos\util\gawk-w32.exe -f lib.awk -f adebug.awk
s\A02.AWK s\A0203F.AWK s\A03.AWK s\A05.AWK s\A07.AWK s\A08.AWK
s\A09.AWK s\A89.AWK s\A93.AWK s\A95.AWK s\A97.AWK s\ACFID.AWK
s\ACNTDUP.AWK s\ADOC.AWK s\ADT.AWK s\ALOGW_~1.AWK s\AMERGE.AWK
s\AMRGUNIQ.AWK s\AORGD1.AWK s\AORGD2.AWK s\APPP.AWK
s\ARPTDUP.AWK s\ASCH.AWK s\ASELCOL.AWK s\AUNIQ.AWK s\AEXPR.AWK
s\AEXPR1.AWK s\AGENPDF.AWK s\ADEBUG.AWK s\ACONS01.AWK >>tmp.txt

My lib.awk contains some standard functions and:
BEGIN {
        startsec = systime();
        starttime = strftime("%Y%m%d %X\t",startsec);
        "cd" | getline currdir
        print starttime currdir ">" ENVIRON["CMDLINE"] >>"alog.txt";

Quote:
}

END {
        endsec = systime();
        endtime = strftime("%Y%m%d %X\t",endsec);
        printf ("%sProcessing took %i \
seconds\n",endtime,(endsec-startsec)) >>"alog.txt";

Quote:
}

I hope this helps.

--
  (  Kees Nuyt; Rotterdam; Netherlands

c[_] Disclaimer: Any opinions etc. are mine, not necessarily my employer's.



Sat, 10 Aug 2002 03:00:00 GMT  
 Command line length - awk on a PC

Quote:

> I had the same problem.  It seems DOS only supports 127 (or was it 255?)
> chars on the command line.  A work around is to use a bash shell for
> DJGPP which supports long command lines, like...


command line file feature of all (most) DJGPP-compiled programs, e.g.


will gather its command line from the real command line and from the
cmdfile.

Regards...
                Michael



Sun, 11 Aug 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Shellexecute command line length

2. Passing command line variables to AWK in shell script

3. Awk Command-line Variables - Thanks!

4. Awk Command-Line Variables

5. Command-Line AWK

6. Command line variable assignment in awk

7. pass regexp to awk on command line

8. Command line options in awk scripts?

9. Help passing command line parameters to awk scripts

10. THANKS: Help passing command line parameters to awk script

11. On some PCs the EXE just retunrs to the command line

12. Want to buy a good command line VHDL simulator for PC

 

 
Powered by phpBB® Forum Software