![]() |
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 same word from two files | tjmannonline | AIX | 4 | 04-06-2008 12:42 PM |
| perl newbie: how to extract an unknown word from a string | wolwy_pete | Shell Programming and Scripting | 3 | 03-23-2008 10:41 AM |
| Extract numbers from a string and store in variables | davewg | Shell Programming and Scripting | 6 | 11-14-2007 05:22 AM |
| grep or awk problem, unable to extract numbers | baghera | Shell Programming and Scripting | 7 | 08-31-2007 04:42 PM |
| extract last word on line to new file | michieka | UNIX for Dummies Questions & Answers | 10 | 05-07-2002 11:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
extract numbers from a word
Hi ppl,
I am a bit lost on this...can some one assist. I know this can be down with awk or sed, but i cant get the exact syntax right. I need to only extract the numbers from a signle word ( eg abcd.123.xyz ) How can i extract 123 only ? Thanks |
|
||||
|
Hi,
i am assuming u have a file containing the strings and each string is uniform as below: ccc.nnn.ccc #where c is alphabet, n is number Code:
nawk -F. '{print $2}' filename
or
$number = `echo line | nawk -F. '{print $2}' ` #not sure if this will work
echo $number
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|