24 lines
373 B
Awk
Executable File
24 lines
373 B
Awk
Executable File
#!/usr/bin/awk -f
|
|
NR==1 {}
|
|
NR==2 {
|
|
head=""
|
|
color=""
|
|
format=""
|
|
for(i=1; i<=NF; i++)
|
|
{
|
|
name=$i
|
|
col=$i
|
|
fmt=$i
|
|
gsub( /\|.*$/,"", name )
|
|
head=head name"="i";"
|
|
|
|
# gsub( /^name/, "", col )
|
|
# gsub( /%.*$/, "", col )
|
|
# color=color"c_"name"=\""col"\";"
|
|
|
|
gsub( /^[^|]*\|/, "", fmt )
|
|
format=format"f"name"=\""fmt"\";"
|
|
}
|
|
print "NR==1{} NR==2{"head" "format"}"
|
|
}
|