|
From: | Byron Dai |
Subject: | FIELDWIDTHS does not work. |
Date: | Wed, 7 Mar 2001 17:09:13 +0800 |
Hi, dear Sirs:
I'm trying a small sample program of gawk. It run in HP-UX. The data file is
(gawk.datasample):
1Swensen, Tim
24
1Trinkle, Dan 22 0Mitchel, Carl 27
While the awk script is (gawk.program):
BEGIN {FIELDWIDTHS=1 8 1 4 1
2}
{ if ($1 == 1) print "Salaried employee "$2,$4" is "$6" years old."; else print "Hourly employee "$2,$4" is "$6" years old." } END {print "End of awk script!"} Result: After the running of $gawk -f gawk.program gawk.datasample, the output is: Hourly
employee is years old.
Hourly employee is years old. Hourly employee is years old. End of awk script! FIELDWIDTHS setting does
not take effect. The $1 of line 1 is 1Swensen, and Tim is $2 and 24 is $3. There
is no
$4 and $6.
BRs/Byron Dai
[X] General Business
Information
[ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary ------------------------------------------------------------------------------------------ DAI NING Software Center Motorola China, Nanjing Division 10F Kingsley Sheraton Hotel, #169 Hanzhong Rd, 210029 Tel: 86-25-6795588 Ext 2259 Fax: 86-25-6795577 Email: address@hidden ------------------------------------------------------------------------------------------ |
[Prev in Thread] | Current Thread | [Next in Thread] |