The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 10:05 AM
String Manipulation Help shadow0001 Shell Programming and Scripting 4 03-09-2008 04:35 PM
string manipulation Cactus Jack Shell Programming and Scripting 9 02-14-2008 01:14 PM
string manipulation hai1973 Shell Programming and Scripting 13 08-20-2007 11:27 AM
awk string manipulation zoo591 Shell Programming and Scripting 2 08-09-2006 12:13 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-11-2006
speedieB speedieB is offline
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
  #2 (permalink)  
Old 08-11-2006
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,414
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.
  #3 (permalink)  
Old 08-11-2006
speedieB speedieB is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 13
thank you Jean-Pierre for the fast solution
  #4 (permalink)  
Old 08-11-2006
ranj@chn ranj@chn is offline Forum Advisor  
Playing with Ubuntu Now!
  
 

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

echo "11byteabc" | tr -cd [:digit:]
  #5 (permalink)  
Old 11-23-2008
halola85 halola85 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 13
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
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0