summaryrefslogtreecommitdiffstats
path: root/util/bin
diff options
context:
space:
mode:
authorroot <root@krebs>2011-09-01 02:18:42 +0200
committerroot <root@krebs>2011-09-01 02:18:42 +0200
commitbb2a234ba756eb600fb6f562e67500d511d4ab39 (patch)
treec89b205e3ad2d20e3aa80ca525e0bbf1e01b4670 /util/bin
parent8a6fd84c70618f5a435d2859b513de6de68dc0d1 (diff)
parent4fb37da707279faf92cc8a054c646336f23dfdbe (diff)
Merge branch 'master' of github.com:/krebscode/painload
Conflicts: .gitmodules oncology/dpfhack_display
Diffstat (limited to 'util/bin')
-rwxr-xr-xutil/bin/hrefs20
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.