dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git
Log | Files | Refs | README

commit f871abfffe3162084ab014477f1ad74ed77604bd
parent 9ca97c271a5779735c0f14ee860fa4426e062441
Author: Duncaen <mail@duncano.de>
Date:   Mon, 13 Feb 2017 01:08:15 +0100

bin: add grurls

Diffstat:
bin/grurls | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/bin/grurls b/bin/grurls @@ -0,0 +1,28 @@ +#!/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] + } +} +{ + # [title](url) + while (match($0, /\[[^]]*\]\([^)]*\)/)) { + lnk = substr($0, RSTART, RLENGTH) + match(lnk, /\[[^]]*\]/) + t = substr(lnk, RSTART+1, RLENGTH-2) + match(lnk,/\([^)]*\)/) + links[i] = substr(lnk, RSTART+1, RLENGTH-2) + sub(/\[[^]]*\]\([^)]*\)/, t " [" i++ "]") + } + # http[s]://foo/bar + while (match($0, /http[s]?:\/\/[^ ]*/)) { + links[i] = substr($0, RSTART, RLENGTH) + sub(/http[s]?:\/\/[^ ]*/, "[" i++ "]") + } + print +}