Is there a way to put a subtotal on a separate line? I am trying to subtotal by $1. I want the word 'total' printed as well.
ex.
input file
111 a b
111 x d
111 j k
222 j 3
222 l 4
333 m 4
444 x e
444 3 o
desired output
111 a b
111 x d
111 j k
111 o b
total 4
222 j 3
222 l 4
total 2
333 m 4
total 1
444 x e
444 3 o
444 4 l
total 3
ex.
input file
111 a b
111 x d
111 j k
222 j 3
222 l 4
333 m 4
444 x e
444 3 o
desired output
111 a b
111 x d
111 j k
111 o b
total 4
222 j 3
222 l 4
total 2
333 m 4
total 1
444 x e
444 3 o
444 4 l
total 3