|
From: | david kerns |
Subject: | Re: [bug-gawk] Gawk feature request - file list |
Date: | Fri, 3 Feb 2017 08:06:54 -0700 |
Can you use wildcards? Most windows ports of gawk do not expand wildcards in the shell, but inside the gawk executable. Quick test (warning, long line wrapped):
H:\WINDOWS\system32>gawk "{print ARGIND, FILENAME; len+=length(FILENAME)+1; nextfile} END{print len}" * * *
1 $winnt$.inf
...
7269 zipfldr.dll
84951
So the equivalent command line length, with wilcards expanded, would be 84951 characters.
HTH.
El 03/02/2017 9:06, Daniele Zanoli escribió:
[..]
Unfortunately I'm often using a Windows port of Gawk (I have to run it
on several PCs of my colleagues) and the windows shell command line is
only 32k characters (or bytes?) long...
I have built a kind of "IDE" which launches awk scripts over files in
order to make it simple to use also for non tech people but currently I
am limited on the max number of files I can handle.
Original Message --------
Subject: Re: [bug-gawk] Gawk feature request - file list
From: address@hidden
To: address@hidden, address@hidden
Date: 1/2/2017, 15:57:18
[...]
--
Often I have to use gawk on a large number of files with a single
execution of gawk (I have to compare some file contents) but it
is very easy to reach the maximum length of the shell command
line, since files are in different paths
So I think it would be useful (not only for me) a new command
line switch to specify a file that contains the names of the
files to process (e.g. gawk .. -list myfilelist.txt ...)
Manuel Collado - http://lml.ls.fi.upm.es/~mcollado
$ cat filelist.awk
BEGIN {
nARGC = 1
for (i = 1; i < ARGC; i++) {
if (ARGV[i] ~ /^@/) {
filelist = substr(ARGV[i],2)
while ((getline filename < filelist) > 0) {
nARGV[nARGC++] = filename
}
close(filelist)
} else {
nARGV[nARGC++] = ARGV[i]
}
}
for (i = 1; i < nARGC; i++) {
ARGV[i] = nARGV[i]
}
ARGC = nARGC - 1
}
[Prev in Thread] | Current Thread | [Next in Thread] |