I guess I’m getting too used to the “it’s been a while!” thingy so, awkward title aside, let’s just move straight to today’s post:
The more I learn about AWK, the more I love it. It’s just that simple. I’ve been trying its powers a bit and came with an awk-mazing (and probably useless, but still exciting) five-lines (sans comments) cute script that emulates the most popular feature (the “-e” option) of our good ol’ boy apropos.
Enter lazyman!
#!/bin/bash
# lazyman.sh - displays the name section of a program’s man page.
# DESCRIPTION
# this tiny script shows the NAME section of a given program’s
# manual page, displaying an output quite similar to “apropos -e”
# but directly calling “man” instead of querying against “mandb”.
params=$(echo $@ | awk ‘END{print NF}’)
case $params in
1) man $1 | awk ‘/NAME/{getline;print}’ ;;
*) echo “usage: lazyman.sh [program]” ;;
esac
That’s all folks! I hope you’ve enjoyed it and thanks for reading!








![Ubuntu Feisty Fawn + Oracle Database 10g XE [WebApp] Ubuntu Feisty Fawn + Oracle Database 10g XE [WebApp]](http://farm2.static.flickr.com/1345/1086311454_f6fc5002f5_t.jpg)