Compare two files if second file contains a domain which is not found in first file than add "Static" in second field.
File1:
cleanwatersaveslives.com WordPress
blood-mate.com CodeIgniter
brotex.com WordPress
File2:
brotex.com
blood-mate.com
cleanwatersaveslives.com
suhailacademy.com
damiastudioz.com
support.techpublications.org
techpublications.org
tekstilworks.com
What i want to get is:
cleanwatersaveslives.com WordPress
blood-mate.com CodeIgniter
brotex.com WordPress
suhailacademy.com Static
damiastudioz.com Static
support.techpublications.org Static
techpublications.org Static
tekstilworks.com Static
awk 'BEGIN {FS=OFS="\t"} NR==FNR {v[$1]=$2} {print $1, (v[$1] ? v[$1] : "static")}' dynamic userdomains | column -t
It gives: blood-mate.com CodeIgniter Static brotex.com WordPress Static suhailacademy.com Static damiastudioz.com Staticcleanwatersaveslives.com
infile2
so why is that present in your output ? You said "compare" not "merge"... Runawk 'NR==FNR {v[$1]=$2;next} {print $1, (v[$1] ? v[$1] : "static")}' file1 file2 | column -t