aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-02-13 21:26:21 +0100
committerDuncaen <mail@duncano.de>2017-02-16 01:09:35 +0100
commit6642f0802e6310be927e95e17c7236452c92c057 (patch)
tree9079a264aa48afc5f298518e037ca76cf0e48924
parent0212c8cf299aaf3b4a7f74bc3861d555365feb36 (diff)
downloaddotfiles-6642f0802e6310be927e95e17c7236452c92c057.tar.gz
bin/grurls: simplify
-rwxr-xr-xbin/grurls14
1 files changed, 4 insertions, 10 deletions
diff --git a/bin/grurls b/bin/grurls
index e6b2e39..d140de1 100755
--- a/bin/grurls
+++ b/bin/grurls
@@ -1,15 +1,9 @@
#!/bin/awk -f
# grurls - substitute and group urls
-BEGIN {
- i = 0
-}
-END {
- for (l = 0; l < i; l++) {
- printf "[%d] %s\n", l, links[l]
- }
-}
-{
+BEGIN { i=0 }
+END { for (l = 0; l < i; l++) printf "[%d] %s\n", l, links[l] }
+length() {
# [title](url)
while (match($0, /\[[^]]*\]\([^)]*\)/)) {
lnk = substr($0, RSTART, RLENGTH)
@@ -24,5 +18,5 @@ END {
links[i] = substr($0, RSTART, RLENGTH)
sub(/http[s]?:\/\/[^ ]*/, "[" i++ "]")
}
- print
}
+{print}