#!/usr/bin/gawk -f # Simple script to split a multi-contacts vcf file in several single ones # Launch as: split_all_vcards.awk .vcf # 06/08/2007 Mario Chisari ($0 == "") {next} ($0 ~ /^FN:/) {fn=substr($0,4) ".vcf"; gsub(/[\/\\:\*\?><|]/, "", fn)} ($0 ~ /^ORG:/ && fn=="") {fn=substr($0,5) ".vcf"} ($0 ~ /^END: ?VCARD/) {print vcard "\n" $0 > fn ; fn=""; vcard=""; close(fn) ; next} {vcard=vcard "\n" $0}