![]() |
|
|
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 |
| search for a string -perl | meghana | Shell Programming and Scripting | 11 | 02-12-2008 09:44 PM |
| Perl: Search for string on line then compare numbers! | Crypto | Shell Programming and Scripting | 2 | 01-22-2008 01:50 AM |
| Perl: Search for string on line then search and replace text | Crypto | Shell Programming and Scripting | 4 | 01-04-2008 10:24 AM |
| Search and Parse string from inside a File | SSims | UNIX for Dummies Questions & Answers | 2 | 11-08-2007 03:50 PM |
| Search string in array (perl) | man | Shell Programming and Scripting | 6 | 07-24-2007 12:14 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Perl: Search for string then parse next line
Hi All, I have a file that I need to be able to find a pattern match on one line then parse data on the next or subsequent lines - I will know which line needs to be parsed beforehand. This is what I currently have: Code:
while (<COMMAND_OUT>) {
if ($_ =~ m/TEST/) {
$enabled_yn{IMSI} = substr($_,-17,15) ;
}
if ($_ =~ m/BAOC/) {
$enabled_yn{BAOC} = substr($_,-3,2) ;
}
if ($_ =~ m/BOIC/) {
$enabled_yn{BOIC} = substr($_,-3,2) ;
}
}
This works find when the string that I need to parse is on the same line but wont work when the string that I need to capture is on the next line. I think the answer lies in manipulating $. but I'm unsure how to do this... Many thanks, pondlife. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|