Lets say I want to collect some statistics over a .txt file that looks like this:
misses 15
hit 18
misses 20
hit 31
I wrote a bash script that just prints every line:
#!/bin/bash 
while read line           
do           
    echo $line 
done <t.txt 
What I want now is this: the example is in pseudocode:
read every line
   if first column is miss add the number to total misses
   if hits add the number to total hits
print total hits, and total misses in a file
I have searched and this can be done with awk. Can you help to do this with awk?
awkYou'll learn more if you let us see how you tried to solve the problem so we can show you how to fix it, rather than just write the program for you.