Finding a number in a .txt file
I'm trying to grab som info that is spat out when I run a certain command. I'm doing this in a script..
At the moment I'm putting the output in a text file, output.txt and I'm trying to analyze it in the next commands.
So, if I run:
ListInfo > output.txt
The number I need to catch in the textfile will sort of look like this:
Lots and lots of information
THIS_IS_THE_SECOND: 045 <--Number I want
My question is; how can I search through output.txt, look for the first string, get the third after that, and extract the last three characters (three digit number) at the end of the line?
Can this be done without first saving to a txt file?
Not sure if that made sense at all..
Thanks alot for your help!