![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| How to extract text from a line in file | findprakash | UNIX for Dummies Questions & Answers | 7 | 12-22-2008 07:19 PM |
| Extract pattern from text line | TehOne | Shell Programming and Scripting | 3 | 10-15-2008 01:46 PM |
| Extract pattern from text line | vampirodolce | Shell Programming and Scripting | 9 | 10-14-2008 12:17 PM |
| awk: need to extract a line before a pattern | npn35 | Shell Programming and Scripting | 17 | 06-29-2008 11:38 PM |
| extract a particular start and end pattern from a line | manish205 | Shell Programming and Scripting | 7 | 02-07-2008 06:18 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
The text line has the following formats: what.ever.bla.bla.C01G06.BLA.BLA2 what.ever.bla.bla.C11G33.BLA.BLA2 what.ever.bla.bla.01x03.BLA.BLA2 what.ever.bla.bla.03x05.BLA.BLA2 what.ever.bla.bla.Part01.BLA.BLA2 and other similar ones, I need a way to select the "what.ever.bla.bla" part out of the text. So basically it has to be based on such regex: Code:
(.*?)(C[0-9]+G[0-9]+|[0-9]+x[0-9]+|Part[0-9]+) where (.*?) is the part I want to extract... any ideas? |
|
||||
|
Sorry, its not clear to me.
Do you want to extract the first or the second part? what.ever.bla.bla - no need to extract this as its a constant C01G06.BLA.BLA2 - for this just strip off the above pattern |
|
||||
|
Quote:
It can be Example1.C11G33 or Bla123.Bla123.C11G33 and so on, I need to extract always the name that is befor the "C11G33" no matter what it is .*? The only thing that stays is the C11G33 or 01x03 or Part01 just with different numbers, just look on my regex example again. |
![]() |
| Bookmarks |
| Tags |
| sed regex |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|