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
string manipulation james6 UNIX for Dummies Questions & Answers 5 06-03-2008 07:05 AM
String Manipulation Help shadow0001 Shell Programming and Scripting 4 03-09-2008 01:35 PM
string manipulation Cactus Jack Shell Programming and Scripting 9 02-14-2008 10:14 AM
string manipulation hai1973 Shell Programming and Scripting 13 08-20-2007 08:27 AM
awk string manipulation zoo591 Shell Programming and Scripting 2 08-09-2006 09:13 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-11-2006
Registered User
 

Join Date: Jul 2006
Posts: 13
sed string manipulation

hi
I am using sed to split a string
this string is 11byteabc I would like to just get the numeric digits.

Code:
echo "11byteabc" | sed 's/*[a-z]//
returns 11byteabc

only solution that works is repeating [a-z] number of times for the letters which is pointless

grateful for any suggestions
thanks
Reply With Quote
Forum Sponsor
  #2  
Old 08-11-2006
aigles's Avatar
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,212
The correct syntax for the regex is :
Code:
echo "11byteabc" | sed 's/[a-z]//g'
or
Code:
echo "11byteabc" | sed 's/[^[:digit:]]//g'
Jean-Pierre.
Reply With Quote
  #3  
Old 08-11-2006
Registered User
 

Join Date: Jul 2006
Posts: 13
thank you Jean-Pierre for the fast solution
Reply With Quote
  #4  
Old 08-11-2006
Playing with Ubuntu Now!
 

Join Date: Oct 2005
Location: Chennai
Posts: 364
tr also works

echo "11byteabc" | tr -cd [:digit:]
Reply With Quote
  #5  
Old 1 Week Ago
Registered User
 

Join Date: Nov 2008
Posts: 10
Hey everybody

I need some help on how to order the data in file such as a file have first name last name and city and i would like to order them to in the same order by using sed

thanks alot for your time
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:44 PM.


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