Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!zen.net.uk!hamilton.zen.co.uk!prichard.zen.co.uk.POSTED!not-for-mail Newsgroups: comp.lang.awk,comp.os.linux.misc From: Geoff Clare Subject: Re: Re (2): Can awk use `grep`? References: User-Agent: XPN/1.2.6 (Street Spirit ; Linux) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Tue, 28 Jun 2011 13:30:23 +0100 Message-ID: Lines: 30 Organization: Zen Internet NNTP-Posting-Host: adec71dc.news.zen.co.uk X-Trace: DXC=XP>l:FBgP]RQfPBdY>`=OX0g@SS;SF6nWRiiCXJE[K>WI?WP=3<`YISJmKn^0gjVoQkVR49jF\?[] X-Complaints-To: abuse@zen.co.uk Xref: x330-a1.tempe.blueboxinc.net comp.lang.awk:447 comp.os.linux.misc:1493 Kenny McCormack wrote: > Geoff Clare wrote: >>Bill Marcum wrote: >> >>> By the way, NR==FNR is true while reading the first file in a list. >> >>Nit-pick: NR==FNR is true while reading the first *non-empty* file. > > The point being that it (NR==FNR) is a kludge for what is really intended > (which is: Is this the first file? Or, more generally: which file is this?) > > What people *should* do is "man up" and accept that we are all using GAWK > (and if we're not, we should be) and use ARGIND as it was intended to be > used. Using the kludge for the sake of compatibility with old, broken AWKs, > is stupid (IMHO, of course...) Personally, I try to stick to what POSIX guarantees, and avoid using extensions in any version of awk. BTW I'm reading this thread in comp.lang.awk. Those reading in comp.os.linux.misc might be less concerned about portability and therefore more inclined to use extensions. However, I have come across Linux systems in the past where "awk" was mawk, not gawk, so if you use gawk extensions make sure you use the name gawk to run it, not just "awk". -- Geoff Clare