![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extract numbers from a word | systemali | Shell Programming and Scripting | 14 | 03-30-2009 03:47 AM |
| Extract numbers from a string and store in variables | davewg | Shell Programming and Scripting | 6 | 11-14-2007 05:22 AM |
| grep for non numbers | shihabvk | Shell Programming and Scripting | 6 | 09-20-2005 09:06 PM |
| grep numbers range | azmathshaikh | Shell Programming and Scripting | 1 | 08-08-2005 07:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
grep or awk problem, unable to extract numbers
Hi, I've trouble getting some numbers from a html-file. The thing is that I have several html-logs that contains lines like this:
nerdnerd, how_old_r_u:45782<br>APPLY: <hour_second> Verification succeded This is some of what I've extracted from a html file but all I really want is the number in the middle. When using awk I get: how_old_r_u:45782<br>APPLY: since there is a space at each end, like a separator for awk. And I tried using grep "[0-9]" but it only takes the whole line containing the number so I get the whole line again. Is there any command that can retreive the numbers only? |
|
||||
|
Quote:
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
|
|
||||
|
Quote:
Code:
awk 'BEGIN {FS=":"} {print substr($2,1,5)}' input.txt
|