nesto/model2.awk

19 lines
282 B
Awk

#!/usr/bin/awk -f
NR==1 {}
NR==2 {
names=""
colors=""
formats=""
for(i=1; i<=NF; i++)
{
name=$i
col=$i
fmt=$i
gsub(/%[\-0-9.*a-z]*\s/,"",name)
head=head$i"="i";"
gsub(/^[^%]*%/,"%",col)
format=format"f"$i"=\""col"\";"
}
print "NR==1{} NR==2{"head" "format"}"
}