dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles # fast
git clone https://src.adamsgaard.dk/dotfiles.git # slow
Log | Files | Refs | README | LICENSE Back to index

extract_urls (304B)


      1 #!/usr/bin/awk -f
      2 {
      3 	if (split($0, words, " ")) {
      4 		for (word in words) {
      5 			if (match(words[word], /(http|https|ftp|gopher):\/\/[A-z0-9\-\/\.\?=%:]+[^'.:\r\?]/)) {
      6 				url = substr(words[word], RSTART, RLENGTH)
      7 				if (!urls[url]++)
      8 					print url
      9 			}
     10 		}
     11 	}
     12 }
     13 
     14 END {
     15 	if (length(urls) < 1)
     16 		exit 1
     17 }