My five thousand line bash script can do things that one hundred thousand lines of code could not do.
On the brightside, at least script monkeys can now look down on vibe coders.
I used awk for the first time today to find all the MD5 sums that matched an old file I had to get rid of. Still have no idea what awk was needed for. 😅 All my programming skill is in Python. Linux syntax is a weak point of mine.
Probably the very same thing that the post talks about, which is extracting the first word of a line of text.
The output of
md5sum
looks like this:> md5sum test.txt a3cca2b2aa1e3b5b3b5aad99a8529074 test.txt
So, it lists the checksum and then the file name, but you wanted just the checksum.
In all my years I’ve only used more than that a handful of times. Just don’t need it really
Now jq on the other hand…
jq
is indispensable
I’ve become a person that uses awk instead of grep, sed, cut, head, tail, cat, perl, or bashisms
sort | uniq -c has entered the chat 🤣
I rather do
${line%% *}
and avoid awk.
Honestly I think 90% of people would never use awk if there was a simple preinstalled command for “print the nth column”
This is definitely somewhere that PowerShell shines, all of that is built in and really easy to use
All my homies use dubious regex
Everything you do with
awk
, you can do withpython
, and it will also be readable.Hmm, but you have to install and run the Python environment for that. AWK is typically present on *NIX systems already. Python seem like overkill for basic text processing tasks.
On Debian the
python
is preinstalled.
10 PRINT BUTTS
20 GOTO 10
cut -d ' ' -f1
master raceWhat’s an awk?
'awk tuah
It’s a Linux command-line program (
awk
). It’s pre-installed practically everywhere, it’s very powerful for string processing, but it also uses a fairly complex syntax.As a result, not many people know how to really make use of it, but
awk '{print $1}'
is something you encounter fairly quickly when you need to get the first word in each line.awk yeah
joke so dark I had to turn up my screen brightness to enjoy it.
Nushell enjoyers represent
– [x] I’m in this picture and don’t like it.