Escaping quote marks

Nils Kassube kassube at gmx.net
Fri Nov 20 21:04:26 UTC 2009


Ray Parrish wrote:
> Nils Kassube wrote:
> > Maybe replace each space character of the URL with "%20"?

> Ahhh, it just dawned on me... I bet I can replace the space
>  characters with %20 as I load each line in from the file. I have no
>  idea how to do that, as bash is not real string handling friendly,
>  but I will work on it some, and see if I can figure out how to.

Is this what you are looking for?

URLs=""
while read ThisLine; do
  case "$ThisLine" in
    *\<loc\>*)
        while test "$ThisLine" != "${ThisLine#* }";do
          x="${ThisLine#* }"
          y="${ThisLine%$x}"
          ThisLine="${y% }%20$x"
        done
        URLs="$URLs $ThisLine"
    ;;
  esac
done < "$MapName"


Nils




More information about the ubuntu-users mailing list