The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 08-31-2007
baghera baghera is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 23
Quote:
Originally Posted by vino View Post
The pattern is not very clear. But you can try


Code:
grep -oE "[[:digit:]]{1,}" input.txt

If that does not satisfy your requirement, perhaps this.


Code:
sed -n -e "s/.*:\([0-9]*\).*/\1/p" input.txt
But if there is more numbers on that line for example:

how_old_r_u:45782<br>APPLY:[30000,t3,t4]:Plummet

It seems when I run the command


Code:
grep -oE "[[:digit:]]{1,}" input.txt

I also get the other numbers is there some way to get only 45782?