Here is a one-line script which uses Perl
to parse the data from the LaunchServices database, based on the answer by Ken Thomases.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -dump | LC_ALL=C tr '\n' '\a' | perl -pe 's/(-{20}\aBundleClass)/\n\1/g' | perl -e 'sub trim {my $s = shift; $s =~ s/\a//g; $s =~ s/\"//g; $s =~ s/\{//g; $s =~ s/\}//g; $s =~ s/^\s+|\s+$//g; return $s}; sub trimCommas {my $s = shift; $s =~ s/,//g; return $s}; while ($line = <STDIN>) {if (index($line, "CFBundleURLTypes = ") != -1) {$urlTypesData = $line; $urlTypesData =~ s/^.*CFBundleURLTypes = .*?\((.*?)[^es] =.*$/\1/g; $urlTypesData =~ s/(^.*)\).*?$/\1/g; @urlTypes = split("}", $urlTypesData); if (trim($urlTypesData) ne "" && int(@urlTypes) > 1) {$name1 = $path = (split("CFBundleExecutable", $line))[0]; $name1 =~ s/.*name:(.*?)\a.*$/\1/g; $name2 = $line; $name2 =~ s/^.*CFBundleExecutable = (.*?)\;.*$/\1/g; $appName = ((index($name1, "(null)") == -1) ? trim($name1) : trim($name2)); $path =~ s/.*path:(.*?)\a.*$/\1/g; print $appName . "\f " . "\033[38;5;173m(path: " . trim($path) . ")\033(B\033[m"; for ($i=0; $i<int(@urlTypes)-1; $i++) {$curUrlName = @urlTypes[$i]; if (index(@urlTypes[$i], "CFBundleURLName") != -1) {$curUrlName =~ s/^.*CFBundleURLName =(.*?);.*$/\1/} else {$curUrlName = "\e[3m[Blank]\e[0m"}; $schemesRaw = @urlTypes[$i]; $schemesRaw =~ s/^.*CFBundleURLSchemes =.*?\((.*?)\).*$/\1/g; @schemes = split(",", $schemesRaw); if (trimCommas(trim(@urlTypes[$i])) ne "") {print "\f\t" . trimCommas(trim($curUrlName)); for ($b=0; $b<int(@schemes); $b++) {print "\f\t\t" . trim(@schemes[$b])}}; print "\f"}}; print "\n"}}' | sort -uf | perl -pe 's/(\n)/\1\1\1/g; s/\f/\n/g'
Here is a few lines of the output:
