AWK is a powerful tool, a language really, that every administrator needs to know. I recommend everyone read about awk and learn how to use it. It can really make your day when you need to do something, quick and dirty. You will definitely win some friends with your awk skills, but probably not too
So lets say you have a text file called list.txt with entries like: What if you wanted to pick a random entry? The easiest solution is to use the ‘shuf’ tool, which is standard on CentOS as part of coreutils. The output would be a random line from our file!
Sometimes you need to print a specific amount of characters from each line output. This can seem like a challenge, but if you know a little awk magic it’s actually not that bad. Below is an easy example of how to output a set amount of characters per line via bash and awk. Print the