commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This command will output 1 if the given argument is a valid ip address and 0 if it is not.
Files containing ascii art (e.g. with .nfo extension) are typically not correctly reproduced at the command line when using cat. With iconv one can easily write a wrapper to solve this:
if [ -z "$@" ]; then echo "Usage: $(basename $0) file [file] ..."
else iconv -f437 -tutf8 "$@"; fi