Manually installing GAWK and overriding BusyBox AWK

Hello,

I've installed gawk via opkg and my purpose is for the whole system to use gawk instead of the busybox version of awk.

Is it ok just to change the linked /usr/bin/awk and point it to /usr/bin/gawk?

Thanks in advance!

Sure, give it a try as it's trivial to change back if you find it breaks something.

I just grepped through /bin and /usr/bin on one of my machines, and it looks like adblock uses gawk in preference to awk if it's installed, so if you're using adblock, make that one of your tests after changing the link.

3 Likes

Yup I'm using adblock and wanting to see if there are speed improvements on my test but adblock already detects if gawk is existing and uses it accordingly.

I'm looking into making all function/utilities that use awk to use gawk instead that's why I was thinking of changing the symbolik link of /usr/bin/awk.

1 Like

That's sort of what I thought. My only real concern in changing the link would be some inconsistency between BB-awk and gawk that would cause "old awk" uses to fail somehow, and adblock might be a good candidate for flushing that out. I suspect though, that although BusyBox awk is minimal, it is also to-the-letter POSIX compliant (most of its apps are), so you'll encounter zero issues with the superset gawk replacing it.

That is also my theory, that replacing it with gawk will not generate issues. Well hopefully we are both right on this hahaha.

Anyway, based on my test scripts, a big improvement in speed when using gawk instead of the BB-awk version.

1 Like

After installing gawk, to remap awk to gawk instead to BusyBox, below are what I did:

cd /usr/bin
rm -rf awk
ln -s gawk awk
cd -

To revert back to BusyBox

cd /usr/bin
rm -rf awk
ln -s ../../bin/busybox awk
cd -
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.