![]() |
Hello and Welcome from 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 |
| 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 |
| splitting the files | sharif | UNIX for Advanced & Expert Users | 9 | 02-13-2008 06:38 AM |
| Splitting of a file | zeusss | Shell Programming and Scripting | 4 | 12-03-2007 02:40 AM |
| Splitting a txt file | mohdtausifsh | UNIX for Dummies Questions & Answers | 6 | 10-04-2006 03:19 AM |
| How to concatenate two strings or several strings into one string in B-shell? | fontana | Shell Programming and Scripting | 2 | 08-26-2005 12:58 PM |
| file splitting | praveen.pinto | UNIX for Advanced & Expert Users | 2 | 02-10-2005 09:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
splitting strings
Hi you,
I have the following problem: I have a string like the followings: '166Mhz' or '128MB' or '300sec' or ... What I want to do is, I want to split the strings in a part with the numbers and a part with letters. Since the strings are not allway three digits and than text i couldn't do this with a simple cut. How to solve this. I suggest there should be an easy way to do this with awk or so, but I am just to stupid to do this. Thanks for any help. Ben Sky |
|
|||||
|
Separate Number from String
Perderabo just posted a solution to a problem very similar to this...
To get the beginning part (with the numbers) use: a="166Mhz"; echo ${a%%[A-Za-z]*} To get the ending part (with the letters) use: a="166Mhz"; echo ${a##*[0-9]} |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|