#!/usr/local/bin/awk # # $Id: fnord.awk,v 1.1 2003/12/23 00:55:39 dope Exp dope $ # # Copyright by Christian Schneider # # Filename : ~/bin/fnord.awk # Purpose : Search for links in a directory and format the output # Author : Christian Schneider # Latest release : # # This script is a part from URL-search() into my ~/.zshrc. # $ functions URL-search # { # if [[ $# = 0 ]] # then # echo "Usage : $0 directory" # echo "Example : $0 ~/Mail" # echo "Example : $0 directory | \$PAGER" # echo "Example : $0 directory > logfile" # else # egrep -r -h -i '((ftp|https|http|www):.*)' $1 | awk -f ~/bin/fnord.awk | sort +| uniq # fi # } # Last modified: [ 2003-12-04 21:38:13 ] BEGIN { regexp = "" regexp = regexp "((http|ftp)://)" regexp = regexp "[-0-9A-Za-z#%&+./:;?_~]" regexp = regexp "*[-0-9A-Za-z#%&+/:;?_~]" } NF { while (match($0, regexp)) { print substr($0, RSTART, RLENGTH) $0 = substr($0, RSTART + RLENGTH) } } END {}