namaycushs
Technical User
Hi,
I want to build the total for each header.
Output of a command looks like this:
Header: A
Type Length
X 10
X 5
X 15
Y 2
Y 5
Y 1
Header: B
X 4
X 10
Y 3
Y 1
Now, I want to pipe it to awk and calculate the total for each Header with type X
For the above print, the result would look like this:
Header: A 30
Header: B 14
I am new to unix script programming and tried out different solutions but failed. Any ideas ?
I want to build the total for each header.
Output of a command looks like this:
Header: A
Type Length
X 10
X 5
X 15
Y 2
Y 5
Y 1
Header: B
X 4
X 10
Y 3
Y 1
Now, I want to pipe it to awk and calculate the total for each Header with type X
For the above print, the result would look like this:
Header: A 30
Header: B 14
I am new to unix script programming and tried out different solutions but failed. Any ideas ?