Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Aug 2010 20:36:24 +0400
From:      Anonymous <swell.k@gmail.com>
To:        merlyn@stonehenge.com (Randal L. Schwartz)
Cc:        lconrad@Go2France.com, freebsd-questions@freebsd.org
Subject:   Re: awk problem
Message-ID:  <8639uiwjuf.fsf@gmail.com>
In-Reply-To: <8639uipjdv.fsf@red.stonehenge.com> (Randal L. Schwartz's message of "Fri, 13 Aug 2010 09:28:12 -0700")
References:  <201008131723.AA679149726@mail.Go2France.com> <8639uipjdv.fsf@red.stonehenge.com>

next in thread | previous in thread | raw e-mail | index | archive | help
merlyn@stonehenge.com (Randal L. Schwartz) writes:

> Len> awk 'FS="." { print $(NF-1)"."$NF }'
>
> Len> rm90.steampick.info.rm90.steampick.info
> Len> lanejive.info
> Len> govdelivery.com
> Len> orangetalon.info
> Len> carespecial.info
>
> Yes, that would be the expected behavior.
>
> You need to set the FS *before* processing the first line.
>
> Either use -F ., or a BEGIN block.

Then it's already fixed in 8.1-RELEASE by update in r201951.

  contrib/one-true-awk/FIXES:
    Nov 26, 2009:
      fixed a long-standing issue with when FS takes effect.  a
      change to FS is now noticed immediately for subsequent splits.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8639uiwjuf.fsf>