The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Extracting spec info from finger. franny UNIX for Dummies Questions & Answers 6 12-12-2007 05:45 AM
Extracting specific info from finger command franny UNIX for Dummies Questions & Answers 1 12-05-2007 10:13 AM
extracting XML file using sed pujansrt Shell Programming and Scripting 7 06-29-2007 10:18 AM
extracting from tar.bz2 Raom UNIX for Advanced & Expert Users 1 03-07-2006 07:33 AM
extracting info from Unix database to construct a visual diagram fusion99 UNIX for Advanced & Expert Users 0 11-29-2004 10:29 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-06-2005
Registered User
 

Join Date: Aug 2004
Location: Pakistan
Posts: 10
Extracting Info

i have a file that contain lines like this
9.4.7.8.5.7.9.0.5.7.1.2.msisdn.sub.cs. 1 IN CNAME SDP01.cs.

there are about 50,000 lines like this in the files i want to the extract the digits from the above line like:-

947857905712

OS Solaris9
Reply With Quote
Forum Sponsor
  #2  
Old 09-06-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,003
Code:
echo '9.4.7.8.5.7.9.0.5.7.1.2.msisdn.sub.cs. 1 IN CNAME SDP01.cs.' | sed 's/^\([0-9.][0-9.]*\).*/\1/;s/\.//g'
Reply With Quote
  #3  
Old 09-06-2005
RishiPahuja's Avatar
Registered User
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Thumbs up

Try :

Code:
cut -c1,3,5,7,9,11,13,15,17,19,21,23 filename > newFile
This is assuming all characters are only digit.

rishi
Reply With Quote
  #4  
Old 09-06-2005
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,609
assuming input of the form that u had specified,

try this

sed -e 's/[a-z].*//;s/\.//g' filename
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0