Nice intro/overview! Awk is great, I've used it a lot ... I remember I often used it to read/parse log files and then generate SQL using Awk, in order to perform database changes. It's very flexible for this kind of extract/transform/output work.
Awk is extremely flexible and easy to use. Can indeed replace cut/grep/join if you want to. And perl, never got into it, too complicated and cryptic, I prefer the C/javascript-like syntax of Awk.
20 year career working for or with ISP's/large enterprises. Software engineer and maker, I thrive when I am the dumbest guy in the room! I love building stuff that's challenging and creative.
Been using UNIX since the late 80s; Linux since the mid-90s; virtualization since the early 2000s and spent the past few years working in the cloud space.
Location
Alexandria, VA, USA
Education
B.S. Psychology from Pennsylvania State University
Interesting! Just wondering why a whole new language for a feature? (Not to sound critical).
Are there any specialised optimizations specific to file i/o and parsing the file at lower level ? If so, it would be great to have it also as wrapper for other langaugaes. Any benchmarking ?
awk is a very old language (1977), predating scripting languages like perl and python. As part of Unix philosophy, it is used in combination with other Unix tools. It is simpler and faster to write than say a python script. Most awk uses are simple one-liners to extract particular columns.
It is indeed very fast as all it does is: For each line:
Check if line matches a pattern
Perform the associated action on the pattern
There was this famous article which showed that clever use of command-line tools can be several times faster than some big-data tools.
Developer turned PM, turned VP of Engineering. I've always worked for IT consulting firms building custom systems for private and public-sector clients. I like leading teams to build cool things.
Nice intro/overview! Awk is great, I've used it a lot ... I remember I often used it to read/parse log files and then generate SQL using Awk, in order to perform database changes. It's very flexible for this kind of extract/transform/output work.
Some Awk one-liners replace my use of other Unix tools like cut, grep, join. Some people use
perl
as a betterawk
but I prefer the simplicity of Awk.Awk is extremely flexible and easy to use. Can indeed replace cut/grep/join if you want to. And perl, never got into it, too complicated and cryptic, I prefer the C/javascript-like syntax of Awk.
Awesome Article! Great Hands on tutorial ❤
Best awk intro/summary I have read, thank you.
Output formatting becomes much better when you ditch
print
in favor ofprintf
.That was a fun introduction. Glad to add that as a tool in my toolbelt
Nice intro, good pointers. Thanks!
The picture is enough for me, thanks the author!
Interesting! Just wondering why a whole new language for a feature? (Not to sound critical).
Are there any specialised optimizations specific to file i/o and parsing the file at lower level ? If so, it would be great to have it also as wrapper for other langaugaes. Any benchmarking ?
🙂🙂
Hi Ishani,
awk
is a very old language (1977), predating scripting languages likeperl
andpython
. As part of Unix philosophy, it is used in combination with other Unix tools. It is simpler and faster to write than say apython
script. Mostawk
uses are simple one-liners to extract particular columns.It is indeed very fast as all it does is: For each line:
There was this famous article which showed that clever use of command-line tools can be several times faster than some big-data tools.
Very helpful! Thanks!
LOVE AWK!!!!!!!!!!!
Wow, pandas in Bash ! Does it support cluster computing? ;)
It may replace your cluster :P
See this article on how a bash script is 235x faster than a Hadoop cluster.