#!/usr/bin/awk -f BEGIN { RS = ">" } /<(ftp|https?):\/\// { gsub(/^.*<(ftp|https?):\/\//, "") gsub(/\/.*$/, "") gsub(/[\n\r ]/, "") if (length($0) > 0) { print tolower($0) } next }