[lfs-support] A bug in gawk?

Bruce Dubbs bruce.dubbs at gmail.com
Fri Oct 11 20:39:37 PDT 2013


alex lupu wrote:
> 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"} ;
>
>   NOR
>
> awk 'BEGIN {FS="\.so"}

See if awk 'BEGIN {FS="\\.so"}...  works for you.

http://www.gnu.org/software/gawk/manual/html_node/Field-Splitting-Summary.html

First paragraph.

   -- Bruce




More information about the lfs-support mailing list