[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with File input in gawk on Win32
From: |
Aharon Robbins |
Subject: |
Re: Problem with File input in gawk on Win32 |
Date: |
Tue, 25 Sep 2001 16:09:30 +0200 |
As far as I can tell, gawk is behaving as it's documented to.
The BEGIN action executes before any input is read. At that
point, $0 is empty, so it should print a single newline.
If there's nothing else in the program, the input is never read.
I suspect that if you put
{ print $0 }
into a file and run it, it will work with no problems. You
might wish to pick up a good book on awk programming. See
http://www.oreilly.com/catalog/awkprog3 for one that I
recommend.
Arnold Robbins
> Date: Tue, 25 Sep 2001 01:43:54 -0400
> From: Reza Ghorieshi <address@hidden>
> To: address@hidden
> CC: address@hidden
> Subject: Problem with File input in gawk on Win32
>
> Hello,
>
> I am having a problem the automated file input feature in gawk under
> win32 (DOS - windows 2000). I am using the following command:
>
> c:\gawk -f program-file input-file1
>
> Unfortunately, the input-file is never read by the program. Thus, given
> a none empty input file, and a program file containing: BEGIN {print
> $0}
> it prints nothing.
>
> However, c:\gawk "{print $0}" input-file1 works fine.
>
> I am forced to use the: while ((getline < "input-file1") > 0)
> method, which I very much would like to avoid.
>
> Any advise/assistance you can provide is much appreciated.
>
> Thank you,
> Reza