|
From: | Volker Kiefel |
Subject: | Problem (multiline records) with gawk 3.0.6 |
Date: | Mon, 5 Mar 2001 12:39:29 +0100 |
Possible bug in gawk v3.0.6
Hello dear maintainer(s) of GAWK,
hello Arnold Robbins, Thank you for the excellent GAWK tool which I often
use
(under Windows 95 SE) instead of commercial spreadsheet software. Recently I encountered some problems in an attempt to process multiple line records. The problem is best exemplified with the example in "Effective AWK-programming" (chapter 5.7: multiple-line records). The data file: Jane Doe
123 Main Street Anywhere, SE 12345-6789 John Smith
456 Tree-lined Avenue Smallville, MW 98765-4321 is processed with the AWK script
BEGIN {
RS = ""; FS = "\n" } {
print "Name is: ", $1 print "Address is: ", $2 print "City and State are: ", $3 print "" } A problem arises with one leading newline (empty
line)
in the "addresses" data file before "Jane Doe", the (unexpected) output is: Name is:
Address is: Jane Doe City and State are: 123 Main Street Name is: John Smith
Address is: 456 Tree-lined Avenue City and State are: Smallville, MW 98765-4321 i. e. there is a shift in output in the first
record.
With RS="" leading empty lines should not influence the result. 0 or 2 leading lines produce the expected result: Name is: Jane Doe
Address is: 123 Main Street City and State are: Anywhere, SE 12345-6789 Name is: John Smith
Address is: 456 Tree-lined Avenue City and State are: Smallville, MW 98765-4321 Kerninghan's AWK in its current version does not
show
this unexpected behaviour. I use gawk v5.0.6 compiled with the
mingw32
implementation of the GCC (v2.95.2) and with the djgpp-implementation of GCC. Can this problem be addressed in a future version of GAWK? Yours sincerely
Volker Kiefel (Rostock, Germany) |
[Prev in Thread] | Current Thread | [Next in Thread] |