summaryrefslogtreecommitdiffstats
path: root/util
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
commit181ee880f53e1b10fce89e74ba429e23382809c1 (patch)
tree2f0f392274a6794f7962ec9dbd13e719e48ca5f7 /util
parentcdbc8c537320e3e534694311516ac398ea501600 (diff)
parent5ad8c950f59472d1d0ad21c13320024889fe2e46 (diff)
Merge branch 'master' of github.com:/krebscode/painload
Conflicts: .gitmodules oncology/dpfhack_display
Diffstat (limited to 'util')
-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.