I need to count Nodes_Util for each Queue. In the example below, queue1 has only one line, but it varies and it could be nothing sometimes and it applies to all queues.I want to dynamically add the number in the column if it exists.Queue    | JOB_ID     | Tasks      | ptile      | Nodes_Utilqueue1   | 220412     | 317        | 8          | 39queue2   | 183623     | 317        | 16         | 19queue2   | 220297     | 192        | 8          | 24queue2   | 220298     | 192        | 8          | 24queue2   | 220299     | 192        | 8          | 24queue2   | 220300     | 192        | 8          | 24queue2   | 220301     | 192        | 8          | 24queue2   | 220302     | 192        | 8          | 24queue2   | 220303     | 192        | 8          | 24queue2   | 220304     | 192        | 8          | 24queue2   | 220305     | 192        | 8          | 24queue3   | 214071     | 187        | 16         | 11queue3   | 214706     | 173        | 16         | 10queue3   | 219981     | 128        | 16         | 8queue3   | 220352     | 512        | 16         | 32queue4   | 218227     | 576        | 16         | 36queue4   | 220371     | 192        |            | 12queue5   | 218106     | 256        | 16         | 16queue5   | 220138     | 32         | 8          | 4queue5   | 220382     | 16         | 8          | 2queue5   | 220396     | 16         | 16         | 1queue5   | 220403     | 16         | 16         | 1queue5   | 220427     | 16         | 16         | 1queue5   | 220566     | 32         | 8          | 4queue6   | 219249     | 256        | 16         | 16queue6   | 219267     | 256        | 16         | 16queue6   | 220001     | 256        | 16         | 16I need to know number of nodes utilized by each queue.
Add the number in the column if exists
shell script;text processing;sed;awk
Something like this will workawk -F *| * 'NR>1{a[$1]+=$NF}END{for(i in a)print i,a[i]}' fileOutputqueue3 61queue4 48queue5 29queue6 48queue1 39queue2 235or if they are in order like your exampleawk -F *| * 'NR==1{next}t!=$1{print t,x;x=}{x+=$NF;t=$1}END{print t,x}' fileOutputqueue1 39queue2 235queue3 61queue4 48queue5 29queue6 48