I'd like to sum up numbers in a plain text file. Is there somehow I can do this with a command or a bash script?
Say I want to extract the number in a pattern that looks like this:
… text text … Removed 50 items out of 50 items. … text text … Removed 34 items out of 50 items. … text text …
So in the case above, I'd like to extract the first number in the lines that they pop up and sum it up. In the example the result should be 84. I know how to grep it, but that's the extent of my knowledge of *nix commands.