The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to replace many numbers with one number in a file vpandey AIX 2 02-27-2008 04:43 AM
to replace one character by numbers in a file cdfd123 Shell Programming and Scripting 7 10-07-2007 07:25 PM
comparing numbers in a file dusk2dawn UNIX for Dummies Questions & Answers 7 09-22-2007 11:54 PM
removing all numbers from file rinku Shell Programming and Scripting 2 05-24-2007 05:33 AM
loop through file of numbers frustrated1 Shell Programming and Scripting 12 08-15-2005 07:32 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-10-2008
Registered User
 

Join Date: Jun 2008
Posts: 7
Stumble this Post!
cut numbers from file

I have a file name "terminal.out"
contents of the file:
<Value>SYcadChangeOrder:3974</Value>
<Value>SYcadChangeOrder:3975</Value>
<Value>SYcadChangeOrder:3976</Value>
<Value>SYcadChangeOrder:3977</Value>
<Value>SYcadChangeOrder:3978</Value>
<Value>SYcadChangeOrder:3978</Value>
<Value>SYcadChangeOrder:3979</Value>

i need to extract only the numbers.Cn somebody help me with this ?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-10-2008
Registered User
 

Join Date: Apr 2008
Location: Bangalore
Posts: 120
Stumble this Post!
cat terminal.out | cut -d":" -f2 | cut -d"<" -f1


Thanks
Penchal
Reply With Quote
  #3 (permalink)  
Old 06-10-2008
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 549
Stumble this Post!
Code:
 awk -F'[<|:]' '{print $3}' file
Reply With Quote
  #4 (permalink)  
Old 06-10-2008
radoulov's Avatar
addict
 

Join Date: Jan 2007
Location: Milan, Italy/Varna, Bulgaria
Posts: 1,516
Stumble this Post!
With Sed:

Code:
sed 's/.*:\([0-9]*\)<.*/\1/' infile
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:14 AM.


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

Content Relevant URLs by vBSEO 3.2.0