Quote:
Originally Posted by radoulov
Code:
awk 'NR == 1 { print "lead1 07q4 07q1 06q4 06q3 sept oct nov tot" }
$1 ~ "^("users")$" && NF > 1 {
x[$1]++
if (x[$1] == 1) {
p[$1] = sprintf ("%s\t%s\t%s\t%s\t%s", $1, $2, $5, $6, $7)
t[$1] = $2 + $5
}
if (x[$1] == 3) {
printf "%s\t%s\t%s\t%s\t%d\n", p[$1], $2, $3, $4, t[$1]
}
}' users="tim|tad" file
|
Can you go a little further in describing the awk methods used on the script, im sorry to be a bother but something like this can be a HUGE ace in my arsenal of shell scripting.