Count Segmentation fault and write to the file

Hi everyone

Need to get version of npm application that have several output like this:

root: nmp -version
10

root: nmp -version
10

root: nmp-new -version
3.1

root: nmp-old -version
Segmentation fault

count them , after that write to the file like this:

10 2
3.1 1
Segmentation fault 1

In awk:

awk '/^root: nmp/ { getline; V[$0]++ } END { for( v in V ) print v " " V[v] }' 
Segmentation fault 1
10 2
3.1 1

This method doesn't guarantee the order. You'd need to modify it slightly to get that, and it's tied to the output exactly as you've presented it.

Why is there an "old" nmp? Perhaps it's seg faulting because some of the underlying libraries it needs have been replaced (because it's old)?