SiegeX's answer is better for this particular case, but you should also know how to pass arbitrary text to
sed is expecting filenames as its second, third, etc. parameters, and if it doesn't find any filenames, it reads from its standard input. So if you have text that you want to process that's not in a file, you have to pipe it to
sed. The most straightforward way is this:
echo "blah blah" | sed 's/blah/blam/g'
So your example would become:
LAT=$(echo "$LATLNG" | sed 's/(\(.*\),\(.*\))/\1/g')
LON=$(echo "$LATLNG" | sed 's/(\(.*\),\(.*\))/\2/g')
Alternate (better but more obscure) Methods
If you think there's any chance that
$LATLNG could begin with a dash, or if you want to be pedantic, you should use
printf instead of
printf '%s' "$LATLNG" | sed 's/foo/bar/g'
Or a "here document", but that can be a little awkward with the construct you're using:
LAT=$(sed 's/foo/bar/g' <<END
Or if you're using
bash and not worried about portability, you can use a "here string":
sed 's/foo/bar/g' <<< "$LATLNG"