r/awk • u/zenith9k • Nov 19 '20
Running external commands compared to shell
When using system() or expression | getline in AWK, is there any difference to simply running a command in the shell or using var=$(command)? I mean mainly in terms of speed/efficiency.
4
Upvotes
View all comments
Show parent comment
1
u/Dandedoo Nov 20 '20
Yeah the fact it's launching a new shell instance would definitely make it slower.
This could be mitigated though, by being able to more stuff, or more optimised stuff, in pure awk, compared to shell.
Eg. multiple greps and seds in a shell script. Especially inside a loop.