I would like to list each unique number after a specific string and a count of how many times this number occurs in a file. The specific string would be 'length' and the first number after it.
Current data for example:
*random string* length: 40
*random string* length: 54
*random string* length: 40
*random string* length: 60
*random string* length: 60
*random string* length: 60
Ideal result would be:
length 40: 2
length 54: 1
length 60: 3
At the moment I am scripting a count of each number I manually see in a 24,111 line file which isn't practical.
cat file.txt | awk '/length: 60/ {total++} END {print total}'