Re: Problem with input record separator

2003-09-22 Thread Paul Johnson
On Mon, Sep 22, 2003 at 10:29:14PM +0100, Rob Dixon wrote: > Daniel Liston wrote: > > > > John W. Krahn wrote: > > > > > Or you could pare that down a bit. :-) > > > > > > #!/usr/bin/perl > > > > > > #syntax: unfold.pl filename > newfilename > > > > > > @ARGV or die "usage: $0 filename\n"; > > >

Re: Problem with input record separator

2003-09-22 Thread Rob Dixon
Daniel Liston wrote: > > John W. Krahn wrote: > > > Or you could pare that down a bit. :-) > > > > #!/usr/bin/perl > > > > #syntax: unfold.pl filename > newfilename > > > > @ARGV or die "usage: $0 filename\n"; > > > > $/ = ''; print for grep [ chomp, s/\n\s+/ /g, s/\z/\n\n/ ], <>; > > I like that

Re: Problem with input record separator

2003-09-22 Thread Daniel Liston
Daniel Liston wrote: Here is a tool I use to unfold long lines in LDAP outputs. It also works on mailboxes that have the Received: lines or Content-*: lines folded. There are two things in your code that may cause a problem. #!/usr/bin/perl #syntax: unfold.pl filename > newfilename if ($AR

Re: Problem with input record separator

2003-09-22 Thread John W. Krahn
Rob Dixon wrote: > > John W. Krahn wrote: > > > > my @records = do { > >local ( $/, *FILE ) = ''; > >open FILE, $ARGV[0] or die "can't open $ARGV[0]: $!"; > >grep chomp, ; > > This will drop the last line of the file if there is no > terminating separator. > > grep {chomp, 1} ; Or

Re: Problem with input record separator

2003-09-22 Thread Rob Dixon
John W. Krahn wrote: > > Daniel Liston wrote: > > > > Here is a tool I use to unfold long lines in LDAP outputs. > > It also works on mailboxes that have the Received: lines > > or Content-*: lines folded. > > There are two things in your code that may cause a problem. > > > > #!/usr/bin/perl > >

Re: Problem with input record separator

2003-09-21 Thread John W. Krahn
Daniel Liston wrote: > > Here is a tool I use to unfold long lines in LDAP outputs. > It also works on mailboxes that have the Received: lines > or Content-*: lines folded. There are two things in your code that may cause a problem. > #!/usr/bin/perl > > #syntax: unfold.pl filename > newfilen

Problem with input record separator

2003-09-21 Thread Daniel Liston
Here is a tool I use to unfold long lines in LDAP outputs. It also works on mailboxes that have the Received: lines or Content-*: lines folded. #!/usr/bin/perl #syntax: unfold.pl filename > newfilename if ($ARGV[0]) { local $/ = ''; open(FILE, "<$ARGV[0]") or die "can't open $ARGV[0]: $!\

Re: Problem with input record separator

2003-09-21 Thread Rob Dixon
Rob Dixon wrote: > > Rajeev wrote: > > > my $seperator = '/(?m:^\s*\n$)/'; > > It will match the following sequence: > > - an optional open parenthesis > - a lowercase 'm' > - a colon > - the start of a new record > - zero or more whitespace characters > - a newline > - the end of a record Just a

Re: Problem with input record separator

2003-09-21 Thread Rob Dixon
Rajeev wrote: > > Hi Rob, > > I have written a routine here .. not exactly whay u told.. before that I have a > problem with regex.. > > I want to pass the regex on which the splitting (or record separation logic in my > code) will happen such that I can call the same function with different reco

Re: Problem with input record separator

2003-09-21 Thread Rob Dixon
"Pandey Rajeev-A19514" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi Paul, > > I has tried the $/ = ""; but it did not work because my logfile itself was faulty. > The problem is that between two paragraphs, the empty line does not match /^\n$/ but > it matches some spaces too

RE: Problem with input record separator

2003-09-21 Thread Pandey Rajeev-A19514
ubject: Re: Problem with input record separator On Sun, Sep 21, 2003 at 04:11:30PM +0530, Pandey Rajeev-A19514 wrote: > I am stuck with input record separator You are correct that you should be changing the IRS ... > I have a

Re: Problem with input record separator

2003-09-21 Thread Paul Johnson
On Sun, Sep 21, 2003 at 04:11:30PM +0530, Pandey Rajeev-A19514 wrote: > I am stuck with input record separator You are correct that you should be changing the IRS ... > I have a file .. say "abc" > > *** > > > AAA

Problem with input record separator

2003-09-21 Thread Pandey Rajeev-A19514
Hi , I am stuck with input record separator I have a file .. say "abc" *** **