I love cheat sheets! I have at least 30 in front of me at the moment scattered throughout my desk – CSS cheat sheet, Awk cheat sheet, keyboard shortcuts cheat sheet for vt100/ansi screen terminal emulator, Emacs and Vim, then Ethernet, IP and TCP header layout cheat sheets, and many, many others.
I have created about 15 out of these 30 and in my future posts I'll make them available for download. These cheat sheets have certainly made me a better developer and I'm super excited that I can share them here on my blog so that you can become a better developer, too.
Someone might say that looking up the information in a
info page, manual or Google is equivalent to looking it up on a cheat sheet, if not better. I disagree.
First of all it is usually, but not always, takes more time to find where in the documentation the particular thing is located but in the cheat sheet you have it right in front of you. For example, suppose you were C programmer and forgot how to print a floating point number, you'd type `man 3 printf' and quickly find the answer. That's fine - it's as fast or even faster than looking something up in a cheat sheet but that's just because you knew exactly what you were looking for! But let's look at Joe Random who just began learning gawk programming language and at the moment wants to replace a part of a string with another string. He'd probably already have the manual open and would start going through it looking for string functions. It would take him a good minute or so before he finds the correct place and reads how the function works. Now, if he had a cheat sheet, like the one I created here, he'd have all the string functions in front of him and he would quickly locate that it is gsub or gensub. He'd find not only that but also all the other string functions and next time he has a problem he might remember the right function subconsciously.
What I want to emphasize is that the cheat sheets are not for NOT remembering things and just looking them up hundreds of thousands of times and never actually learning them but are FOR remembering and learning new things faster.
It is also interesting to find what technologies you have not used for a while because the cheat sheets pile up in most recently.
I made this cheat sheet in Microsoft Word because I am not that good with TeX, particularly formatting data so it looked nice.
So the awk cheat sheet is available in .doc and .pdf. I will usually post the cheat sheets in these two formats.
This cheat sheet contains:
- Predefined Variable Summary, which lists all the predefined variables and which awk versions (original awk, nawk or gawk) have it built in,
- GNU awk's command line argument summary,
- I/O statements,
- Numeric functions,
- Bit manipulation functions,
- I18n (internationalization) functions,
- String functions, and finally,
- Time functions.
Let me know if you notice any inaccuracies, mistakes or see that I have left something out.
Download AWK Cheat-Sheet
- PDF document: awk.cheat.sheet.pdf
- Plain text (.txt): awk.cheat.sheet.txt
- MS Word (.doc): awk.cheat.sheet.doc
See you next time!