Hi friends,

Previously I had a post regarding url encoding and decoding, This is much improved version of that script. To know more about urlencoding, try this link, http://www.blooberry.com/indexdot/html/topics/urlencoding.htm

# urlencode - program to urlencode/urldecode
# Author: Mohan Raman
# License: Its in public domain.

	urlencode [-e|-d] [-h]

	-e	URLEncode standard input(default)
	-d	URLDecode standard input

	$ urlencode

	$ urlencode -d

sed -e's/./&\n/g' -e's/ /%20/g' | grep -v '^$' | while read CHAR; do test "${CHAR}" = "%20" && echo "${CHAR}" || echo "${CHAR}" | grep -E '[-[:alnum:]!*.'"'"'()]|\[|\]' || echo -n "${CHAR}" | od -t x1 | tr ' ' '\n' | grep '^[[:alnum:]]\{2\}$' | tr '[a-z]' '[A-Z]' | sed -e's/^/%/g'; done | sed -e's/%20/+/g' | tr -d '\n'; echo

sed -n -e's/%\([0-9A-F][0-9A-F]\)/\\x\1/g' -e's/+/ /g' -e's/.*/echo -e "&"/g' -ep | "${SHELL}"


while getopts "edh" OPTION
	case "${OPTION}" in
	d) DECODE="1";;
	h) echo "${HELP}"; exit 0;;
	\?) echo "${USAGE}"; exit 1;;

test "${DECODE}" = "0" && encode
test "${DECODE}" = "1" && decode

Download: urlencoder

freebsdman – script to display ‘man’ pages from freebsd.org

Hi friends,

I love FreeBSD’s Documentation(FreeBSD too), Its one of the top class documentations available for UNIX. I think they are capturing nearly every thing about UNIX.

Previously I’ll go to their man page site “http://www.freebsd.org/cgi/man.cgi”, give the command name and get the man page whatever format I want(pdf is damn good!!). But I thought It will be useful if I have an alternative to that *crap* man command in my ‘Ubuntu’ so that I can get all the ‘man’ pages available for Entire Unix family.

Somewhere I saw a small script which gets input from user and generating a URL with GET method parameters and connecting with the server using ‘curl’. Then I decided to do the same thing with my freebsd server, here is the result, a script which will get command name and display the man page, it can be used to get the pdf document also.

        freebsdman [-a 0|1] [-s section] [-d distro]
                [-f format] [-o] [-h]

        -a 0|1          do 'apropos' search(1-enable, 0-disable)
        -s section      select man section(1-8)
        -d distro       distribution name
        -f format       appropriate format
        -o              list available values for other options.
        -h              print this help

        $ freebsdman ps
                will display man page of 'ps' command from latest
                FreeBSD version in terminal(format: ascii).

        $ freebsdman -d 'solaris' -f pdf mpstat > mpstat.pdf
                will generate 'mpstat.pdf' file which contains
                manual page of 'mpstat' from solaris.

        $ freebsdman -o
                will list all valid values for 'freebsdman' options.

        $ freebsdman -d 'x11' X
                will display 'X' manual (note: manual will not be displayed
                without -d 'x11' option)

Download: freebsdman

One day I’ll have FreeBSD in my Lappy :)