echo "$XXX" | perl -n -e 'if (m[^/.+/([^/\?\s;]+)(?:;arg=)?]) {print "$1\n";}' ^