extracting numbers from strings

Hello all,

I am being dumb with this and I know there is a simple solution.

I have a file with the follwing lines

 bc stuff (more)...............123
 bc stuffagain (moretoo)............0
 bc stuffyetagain (morehere)......34
 failed L3 thing..............1
 failed this status.............24
 failed that status.............253
 failed some kind of check........0

I want to pull the numbers off the end of the lines. I can use cut but that is not very robust. I have been using sed but cannot get it to work properly.

I don't think this is very hard. It's been a long day.

Thanks!

gobi

If you just want to extract the last field:

$ sed -n 's/.*\.//;p' gobi.txt
or
$ awk 'BEGIN{FS="."} {print $NF}' gobi.txt

And to extract the digits:

$ sed 's/.*\.\.\([0-9]*\).*/\1/' gobi.txt

//Jadu

yes thank you.

I left out the \.\. from the sed command. like I said its been a long day.

Thanks!