Dear all
What follows is a simple awk program with a shell wrapper. The problem is sometimes it works fine and sometime it won't.
##########################################################
for ((i=1990;i<=2006;i++))
do
awk 'BEGIN{FS=OFS="\t"} {if ($2==m) print $1,$3,$4}' m=$i GI> tmpGI
awk 'BEGIN{FS=OFS="\t"} {if ($29==m) print $0}' m=$i BK > tmpMFW
awk 'NR==FNR{ara[toupper($1)]=$0;next} toupper($1) in ara {print $0"\t"ara[toupper($1)]}' tmpGI tmpMFW >> BKGIm
done
##########################################################
where "tmpMFW" has 30 fields, table delimited; and evidently "tmpGI" has 3 fields (for both of them, the matching key is $1). for the same file BK and GI (I found this problem when rerun the same program), the outfile "BKGIm" sometimes has 33 fields and sometimes get only 31 fields, the first 2 fields from "tmpGI" are missing. now it stays 31, there must be something wrong, can anybady suggest what might lurk behind.
Thank You
will
What follows is a simple awk program with a shell wrapper. The problem is sometimes it works fine and sometime it won't.
##########################################################
for ((i=1990;i<=2006;i++))
do
awk 'BEGIN{FS=OFS="\t"} {if ($2==m) print $1,$3,$4}' m=$i GI> tmpGI
awk 'BEGIN{FS=OFS="\t"} {if ($29==m) print $0}' m=$i BK > tmpMFW
awk 'NR==FNR{ara[toupper($1)]=$0;next} toupper($1) in ara {print $0"\t"ara[toupper($1)]}' tmpGI tmpMFW >> BKGIm
done
##########################################################
where "tmpMFW" has 30 fields, table delimited; and evidently "tmpGI" has 3 fields (for both of them, the matching key is $1). for the same file BK and GI (I found this problem when rerun the same program), the outfile "BKGIm" sometimes has 33 fields and sometimes get only 31 fields, the first 2 fields from "tmpGI" are missing. now it stays 31, there must be something wrong, can anybady suggest what might lurk behind.
Thank You
will