![]() |
|
|
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 |
| sed: find match and delete the line above | cstovall | Shell Programming and Scripting | 3 | 07-02-2008 11:31 PM |
| Perl: Match a line with multiple search patterns | Juha | Shell Programming and Scripting | 10 | 04-09-2008 02:43 AM |
| Multiple line match using sed | SiftinDotCom | Shell Programming and Scripting | 15 | 03-28-2008 02:12 PM |
| read and match multiple lines in perl | zx1106 | Shell Programming and Scripting | 5 | 03-14-2008 10:21 PM |
| sed - Replace Line which contains the Pattern match with a new line | kousikan | Shell Programming and Scripting | 2 | 03-24-2007 07:24 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hello Experts, I am newbie to perl, just curious to know how to do the following in perl. suppose I ve a txt file like below. when it founds "*Main Start" Then go to "*Main End,,,,,,,," patteren and just collect the number from the previous line of "*Main End,,,,,,," pattern . In my case it is 5 . Then start excuting normally from the "*Main Start" position Following is the picture .. I dont want to create any temp file also.. Input file: Code:
*Init End *Main Start *Comment Reset Timers 000000,0000,0,0,0,0,0,1,0 000000,0000,0,0,0,0,1,1,0 *Comment Control Frame at 1.04596 ms 000000,0400,0,0,0,0,1,0,1 2418A4,0000,0,1,3,0,0,0,0 049C00,0000,0,0,2,0,0,0,0 *Comment Control Frame at 1.04673 ms *Comment Control Frame at 000002,0000,0,0,0,0,1,0,1 241002,0000,0,1,3,0,0,0,0 000100,0000,0,0,2,0,0,0,0 *Comment Control Frame at 000004,0000,0,0,0,0,1,0,1 241002,0000,0,1,3,0,0,0,0 000000,0000,0,0,2,0,0,0,0 *Comment Frame 13 at ** us,,,,,,,, 000005,7E3D,0,0,0,0,1,0,1 *Main End,,,,,,,, output: Code:
*Init End *Main Start repeat(5); process all lines as usual here. ............ *Main End,,,,,,,,, I ve to print all lines as it is when it found a line starting with * . Thats why I am doing like below Code:
if(m/^\*/){
print "//", $_;
next;
}
Code:
Basic Algorithm of my programme need : 1. If "*Main Start" pattern found go to line where Pattern matches "*Main end". 2. Get the previous line. and get the value of the first field. 3. Return to "*Main start" position again. & Print repeat(that number) : in my case it is 5 : 4. stop/next; Any help most appriciated.. regards, user_prady Last edited by user_prady; 03-28-2008 at 12:51 AM.. |
| Bookmarks |
| Tags |
| perl, perl regex, perl shift, regex, shift, shift perl, solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|