[lfs-support] A bug in gawk?

alex lupu alupu01 at gmail.com
Fri Oct 11 20:22:30 PDT 2013

On Fri, Oct 11, 2013 at 10:48 PM, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:

> >> alex lupu wrote:
    >>  ...
    []$ cat tempx.txt | awk 'BEGIN {FS=".so"} ; {print $1}'
    >> ...
    >> Is there a problem with GNU gawk and/or my system or maybe with me?

> > You.
> > echo libsndfile.so.1.0.25 | sed -r 's/(.*)\.so.*/\1/'
> > Or
> > for f in `cat tempx.txt`; do echo $f | sed -r 's/(.*)\.so.*/\1/'; done
> Hi Bruce,

The subject question has been, is there a bug in gawk?

As I showed, gawk can take a bunch of characters as field separator:

awk 'BEGIN {FS="YYY"} ; {print $1}' ...

but NOT

awk 'BEGIN {FS=".so"} ;


awk 'BEGIN {FS="\.so"}

I.e., it seems it _cannot_ recognize the dot as a character - which is
while 'sed' (as all our examples illustrate) has no problem with handling
I didn't ask for 'sed' examples.  I was talking about 'awk'.
I'm pretty sure people could easily come up with examples of solving my
in perl, python and c++ (besides 'sed').

'gawk' does recognize other strange characters (other than dot) without
I've never seen any documentation about 'awk' NOT handling the dot (in
or otherwise).  BTW, as we all know, in linux, awk is just a pointer to GNU

-- Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-support/attachments/20131011/2c013a00/attachment.html>

More information about the lfs-support mailing list