dissect_url 457B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. dissect() {
  3. echo $* | perl -pe '
  4. s|(\w)(/[^/])|$1\n $2|;
  5. s|\?|\n ?\n |;
  6. s|#|\n #\n |;
  7. s|&|&\n |g;'
  8. echo ""
  9. }
  10. if [[ -n "$1" ]]; then
  11. dissect "$1"
  12. else
  13. i=0
  14. while read url;
  15. do
  16. if [[ -z "$url" ]]; then exit 0; fi
  17. i=`expr $i + 1`
  18. printf "=== url %02d =============================================\n" $i
  19. dissect "$url"
  20. done
  21. fi