123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. dissect() {
  3. #
  4. # Print "dissected" version of $Url
  5. #
  6. echo "$Url" | perl -pe '
  7. s|(\w)(/[^/])|$1\n $2|;
  8. s|\?|\n ?\n |;
  9. s|#|\n #\n |;
  10. s|&|&\n |g;'
  11. echo ""
  12. }
  13. main() {
  14. local Url=$1
  15. local i=0
  16. test -n "$Url" \
  17. && dissect \
  18. && return 0
  19. grep . \
  20. | while read -r Url;
  21. do
  22. ((i++))
  23. printf '=== url %02d =============================================\n' $i
  24. dissect
  25. done
  26. }
  27. main "$@"