diff options
author | makefu <github@syntax-fehler.de> | 2011-08-30 11:25:00 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2011-08-30 11:25:00 +0200 |
commit | bbf2bc45f02e8795b8cda6dde262226cd658bfd4 (patch) | |
tree | 4089d3fd6ac40c0d5a91dae46a444d4c62139a22 /util/bin/hrefs | |
parent | cd4f8b3394e02bcb7d86d53d1b98b4b4b868b78b (diff) | |
parent | b1f0a73e5810aed4fd78aad2bb55a8a67f76df5d (diff) |
Merge branch 'master' of github.com:krebscode/painload into punani_files
Conflicts:
.gitmodules
Diffstat (limited to 'util/bin/hrefs')
-rwxr-xr-x | util/bin/hrefs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/util/bin/hrefs b/util/bin/hrefs new file mode 100755 index 00000000..3a1a51de --- /dev/null +++ b/util/bin/hrefs @@ -0,0 +1,20 @@ +#! /bin/sh + +_hrefs() { + sed -n 's/href="\([^"]\+\)"/\n&\n/gp' | + sed -n 's/^href="\([^"]\+\)"$/\1/p'; } + +_add_prefix_to_relative_hrefs() { + sed '/^http:/!s^'"$1"''; } + +_main() { + case $# in + (0) _hrefs;; + (1) _hrefs | _add_prefix_to_relative_hrefs "$1";; + (*) + echo "bad command line: $0 $*" >&2; exit 23;; + esac; } + +set -euf +_main "$@" +#### end of file. |