It could be just me but..... perl -e 'while(<>){print "$1\n" if /-->(.*)<--/; }' inputFile > outputFile
is pretty much the same as somethign like: #!/usr/bin/perl use strict; use warnings; my @array; open( IN, "<inFile.log") or die $!; while (<IN>) { my ($text) = $_ =~ m/-->(.*)<--/; push( @aaray, $text); } close(IN); foreach( @array ) { print $_ . "\n"; } Then again if you are modifying an existing script and are not able to see that the one liner and the "script" code is basicaly the same you might want to read up a bit on perl and how things work before you start modifying an existing script. Regards, Rob On Nov 22, 2007 3:57 PM, avinashsuratkal <[EMAIL PROTECTED]> wrote: > On Nov 22, 2:22 pm, [EMAIL PROTECTED] (Avinashsuratkal) > wrote: > > On Nov 22, 2:27 am, [EMAIL PROTECTED] (Yitzle) wrote: > > > > > > > > > > > > > On Nov 21, 2007 11:28 AM, avinashsuratkal <[EMAIL PROTECTED]> > wrote: > > > > > > Hi, > > > > > > I have the following log and my requirement is to capture the block > > > > from one "-->" symbol to another. and put it in other file, using > > > > perl. > > > > > > --------------------------------- > > > > --> Checking Server Hostname <-- > > > > --------------------------------- > > > > Server Hostname: xxxxxxxxx > > > > --------------------------------------- > > > > --> Checking Authentication Domain <-- > > > > --------------------------------------- > > > > Server is authenticating against: xxxxxxxxx > > > > > > -------------------------------------- > > > > --> Validating DNS Server Entries <-- > > > > -------------------------------------- > > > > Servers should conform to global ANYCast Standard > > > > > > Thanks > > > > Avinash > > > > > You mean you want to turn the above input into somthing like this? > > > ------------------------------------- > > > Checking Server Hostname > > > Checking Authentication Domain > > > Validating DNS Server Entries > > > ------------------------------------- > > > > > $ perl -e 'while(<>){print "$1\n" if /-->(.*)<--/; }' inputFile > > outputFile- Hide quoted text - > > > > > - Show quoted text - > > > > Hi Yitzle, > > > > Thank you for the reply... > > > > I want my output to be entered temporary in /tmp/output for further > > processing. > > > > --> Checking Server Hostname <-- > > --------------------------------- > > Server Hostname: xxxxxxxxx > > > > Thanks.- Hide quoted text - > > > > - Show quoted text - > > Hi, > > In short I need to read the text between 2 lines, which can be > incorporated in the perl script, but not a one-liner. > > Thanks, > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > >