bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk: invalid read and write


From: Stephane Chazelas
Subject: Re: gawk: invalid read and write
Date: Sun, 28 Jan 2007 19:12:04 +0000
User-agent: Mutt/1.5.6i

On Sun, Jan 28, 2007 at 07:50:57PM +0100, Jürgen Kahrs wrote:
> Andrew J. Schorr wrote:
> 
> >> Wouldnt it be enough to just change it to
> >>
> >>   awk '...'  log.[0-9]* log.pid[0-9]*
> > 
> > Or, even more simply, log.*  (if you include
> > both wildcards, then one may not have any matches, and
> > that will cause an error, I think).
> 
> Your reasoning is correct. But in reality, any
> user will have either valgrind 1 or valgrind 2,
> not both.
[...]

It should also be noted that "log.[0-9]*" also matches log.0foo
or log.1.gz.

So you could as well do

awk '
  BEGIN {
    for (i = 1; i < ARGC; i++)
      if (ARGV[i] !~ /^log\.(pid)?[0-9]+$/)
        delete ARGV[i]
  }
  ...' log.*[0-9]*

Note that if there's no matching file, stdin will be considered.

-- 
Stéphane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]