|
From: | Miriam English |
Subject: | Re: [bug-gawk] gawk not working properly on the first line |
Date: | Tue, 12 Aug 2014 10:41:53 +1000 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120604 Firefox/13.0 SeaMonkey/2.10 |
Davide Brini wrote:
On Tue, 12 Aug 2014 01:55:42 +1000, Miriam English <address@hidden> wrote:
[snip]
Is this a genuine bug or am I misusing awk somehow?You are supposed to set FS before awk reads and tries to parse the line; in this case, that means setting it in the BEGIN block or on the command line with -v. This is documented in the gawk manual, see https://www.gnu.org/software/gawk/manual/gawk.html#Field-Splitting-Summary the box titled "changing FS does not affect the fields".
Doh! Thank you Davide. I can hardly believe I missed that. Works perfectly now. Yay! I'm very grateful.
-- If you don't have any failures then you're not trying hard enough. - Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory ----- Website: http://miriam-english.org Blogs: http://miriam-e.dreamwidth.org http://miriam-e.livejournal.com
[Prev in Thread] | Current Thread | [Next in Thread] |