This OTW code takes Ra,Dec in sexigecimal format as input and write to standard output the URL-encoded version. This single string can be fed to 2mass02 and used as the "objstr" value used in the wget call to the IRSA 2MASS Point Source Catalog.
% encode2mass.sh 12:33:44.12 -21:33:23.1 12+33+44.12+-21+33+23.1