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

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

Re: <inputfile


From: Aharon Robbins
Subject: Re: <inputfile
Date: Mon, 14 Oct 2002 13:40:29 +0200

Greetings. Re this:

> Date: Mon, 14 Oct 2002 12:16:50 +0200
> From: Thomas Fischer <address@hidden>
> To: address@hidden
> Subject: <inputfile
> Hi,
>
> BEGIN {
> } {
> lf=length(FILENAME);
> print lf;
> print $1
> } END {
> }
>
> if I call this program with: gawk -f test.awk <probe.dat
> the data are reproduced but FILENAME is not recognized
>
> if I call this program with: gawk -f test.awk probe.dat
> the data are reproduced and FILENAME is recognized
>
> is this intended?
>
> I use GNU Awk 3.0.6 under linux, suse 7.2
>
> regards
>
> Dr. T. M. Fischer
> Institut fuer Physiologie, RWTH-Aachen, D-52057 Aachen
> phone: +49 241 80 88805
> fax:   +49 241 8082 434

This is correct behavior.  FILENAME changes as awk goes through
each file named on the command line.  Its initial value is the
empty string.  When you use < file to read data, awk never
goes through the files in ARGV, and thus it never updates FILENAME.

I hope this helps.

Arnold




reply via email to

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