linux - Should I always use GAWK over AWK? -


i see features of awk included in gawk, besides using system doesn't have gawk installed, there ever reason should use awk versus gawk? awk have better performance on gawk?

awk can refer many things. there's awk-the-standard, , there's many different implementations, 1 of gawk.

not using implementation-specific features means you'll have high(er) chance code run unchanged on other implementations of awk-the-language.

gawk, being 1 implementation of awk-the-language, claims conform awk-the-standard, while adding features.

$ man awk … description    gawk gnu project's implementation of awk programming    language.  conforms definition of language in    posix 1003.1 standard.  version in turn  based  on     description in awk programming language, aho, kernighan,    , weinberger.  gawk provides additional features found in    current version of brian kernighan's awk ,   number  of    gnu-specific extensions. … 

as speed, using gawk "plain" awk should make no difference — often, when gawk installed, awk symlink gawk means they'll same program.

however, using gawk-specific features mean you'll locked in specific implementation — if (hypothetically) you'd find faster implementation, you'd have adapt script instead of swapping out binary. (there may implementations faster, don't know of i've never had need make awk scripts run faster.)

personally, tend stick "plain" awk , not use gawk-specific features, if don't care switching other implementation, using gawk extensions might make script easier write , save time on end.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -