[lfs-support] A bug in gawk?

Bruce Dubbs bruce.dubbs at gmail.com
Sat Oct 12 08:54:48 PDT 2013


alex lupu wrote:
>> Bruce wrote:
>> See if awk 'BEGIN {FS="\\.so"}...  works for you.
>
> Hi Bruce,
>
> It DOES !!!
> Thank you very much!
>
> As an aside, (to explain) why _I_ prefer 'awk' to 'sed' _in this case:
>
> for f in `cat tempx.txt`; do echo $f | sed -r 's/(.*)\.so.*/\1/'; done
>
> vs.
>
>   cat tempx.txt | awk 'BEGIN {FS="\\.so"} ; {print $1}'

awk is very powerful, but generally useful in more complex cases.  It 
also has a bit more overhead than sed.  If I can do it in one line with 
sed, that is my preference.

Come to think of it, I generally will use php instead of awk for those 
more complex needs.  That's much more powerful and the code is easier to 
understand.

   -- Bruce




More information about the lfs-support mailing list