![]() |
|
|
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 |
| Append values before a string | Nandagopal | Shell Programming and Scripting | 2 | 04-11-2009 07:04 AM |
| How to delete ctrl key values in a given string? | balan_mca | Shell Programming and Scripting | 4 | 10-16-2008 12:03 PM |
| to separate values from a string | ssuresh1999 | UNIX for Dummies Questions & Answers | 3 | 10-07-2008 01:23 PM |
| Determine string in Perl. | ejdv | Shell Programming and Scripting | 4 | 05-14-2008 05:34 AM |
| $A is a number / any other string? How to determine ? | csaha | Shell Programming and Scripting | 2 | 02-21-2006 04:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
[ksh, awk] determine values from rather complcated string
Hi there, I tried and tried, but cannot solve this myself. I have this string: Code:
enterprises.alcatel.nmu.genos.alarmHandoff.alarmHandoffPurge.purgelistAlarmIds.0 = {alarmId=63868|friendlyName=Dortmund/r01sr1sl01/port#06-#01-Vc12|probableCause=Server Signal Failure},{alarmId=63924|friendlyName=Dortmund/r01sr1sl01/port#06-P|probableCause=Loss Of Signal}
I need to have the alarmId values "63868" and "63924" extracted from it. The alarmId values are variable of course. And it can be that 1 to endless amount of alarmIds are present. So, in this example there are 2, but it can be 1 and it can be 50. I need to use it in a ksh script. Any ideas ? Thanks in advance, E.J. |
|
||||
|
Code:
$str='enterprises.alcatel.nmu.genos.alarmHandoff.alarmHandoffPurge.purgelistAlarmIds.0 = {alarmId=63868|friendlyName=Dortmund/r01sr1sl01/port#06-#01-Vc12|probableCause=Server Signal Failure},{alarmId=63924|friendlyName=Dortmund/r01sr1sl01/port#06-P|probableCause=Loss Of Signal}I need to have the alarmId values "63868" and "63924" extracted from it.';
@tmp=$str=~/alarmId=([0-9]+)/g;
print join "\n", @tmp;
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|