On Fri, Oct 11, 2013 at 10:48 PM, Bruce Dubbs <[email protected]> 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"} ;

 NOR

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

I.e., it seems it _cannot_ recognize the dot as a character - which is
_should_
while 'sed' (as all our examples illustrate) has no problem with handling
it.
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
question
in perl, python and c++ (besides 'sed').

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

Cheers,
-- Alex
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to