open(FH, "<$file");
  while <FH> {
    s/(/(\n    /g
    s/\n)/)/g
    push @newoutput
  }
close FH;

open(HH, ">$file");
print HH @newoutput;
close HH;


It's untested, you might need to add some backslashes in front of the substitutions
but this should be it. There is probably someone else that does it faster, but
at least I tried :)

Regs David
--------------------------
> 
> My original line is:
> ci(abc...
> ..
> ..
> ..
> );
> 
> I want to change  this to
> 
> ci(                           //This and the line next to it are new lines
>    abc....
> ..
> ..
> ..);
> 
> How to do this .?Can some one help me out.
> 
> Regards.,
> Avanish
> ----- Original Message -----
> From: "inSite Internet Solutions" <[EMAIL PROTECTED]>
> To: "Avanish Pathak" <[EMAIL PROTECTED]>; "Troy May" <[EMAIL PROTECTED]>;
> "Bill Lyles" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Friday, May 24, 2002 8:12 PM
> Subject: RE: Can someone Help me out with this
> 
> 
> > Whoops, correction...
> >
> >  else
> >   {
> >    $line =~ s/(\n)+(\r)+//g; # use $line instead of $_
> >    ($cmdline) = split(/,/,$line);
> >    print OUT "$cmdline \n";
> >   }
> >
> >
> >
> > -----Original Message-----
> > From: inSite Internet Solutions [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 24, 2002 9:39 AM
> > To: Avanish Pathak; Troy May; Bill Lyles; [EMAIL PROTECTED];
> > [EMAIL PROTECTED]
> > Subject: RE: Can someone Help me out with this
> >
> >
> > I don't know if this is the most efficient way to do it, but it worked.
> >
> >
> > #!C:\Perl\bin\perl.exe -w
> >
> > use strict;
> > my $infile = qq(C\:\\cmd.txt);
> > my $outfile = qq(C\:\\cmdout.txt);
> > my $cmdline;
> >
> > open(IN,"<$infile") or die "Whoops! Look what happened. $! \n";
> > open(OUT,">$outfile") or die "Could not open \'cuz $! \n";
> >
> > while(<IN>) {
> >  my $line = $_;
> >  if(($line =~ /cmd1/) or ($line =~ /cmd2/))
> >   {
> >    next;
> >   }
> >  else
> >   {
> >    $_ =~ s/(\n)+(\r)+//g;
> >    ($cmdline) = split(/,/,$line);
> >    print OUT "$cmdline \n";
> >   }
> > }
> > close(OUT); # blue light special on aisle #6
> > close(IN); # we've got the suspect surrounded
> > 1;
> >
> >
> >
> > Scot R.
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Avanish Pathak [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, May 24, 2002 2:02 AM
> > To: Troy May; Bill Lyles; [EMAIL PROTECTED];
> > [EMAIL PROTECTED]
> > Subject: Can someone Help me out with this
> >
> >
> > Hi ,
> >      Can some one provide me with a perl script for this:
> >
> > Problem:
> > ci_cmd1="abcdef",          // line1
> > ci_cmd2="ghijk",             // line2
> > ci_cmd3="lmnop",           // line3
> > ci_cmd4="pqrst",             // line4
> >
> > I want to delete line 1 and 2 and the above should look like as shown
> below:
> >
> > ci_cmd1="lmnop",
> > ci_cmd2="pqrst",
> >
> > A prompt response will be highly appreciated.
> >
> > Regards.,
> > Avi
> >
> >
> > ----- Original Message -----
> > From: "Troy May" <[EMAIL PROTECTED]>
> > To: "Bill Lyles" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Wednesday, April 17, 2002 8:52 AM
> > Subject: RE: Definition
> >
> >
> > > It just makes dealing with quotes alot easier.  And you don't need to
> > escape
> > > the extra quotes within it.  For example,
> > >
> > >
> > > print "value=\"true\"";
> > >
> > > print qq!value="true"!;
> > >
> > > print qq/value="true"/;
> > >
> > >
> > > are all the same.  The qq uses the next character instead of the "
> > > character.  Then you must end the line with the same character you
> started
> > > with.  (qq!....!,  qq/..../, qq~....~)
> > >
> > > Sorry, it's hard to explain in an email.
> > >
> > >
> > > -----Original Message-----
> > > From: Bill Lyles [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, April 16, 2002 7:31 PM
> > > To: [EMAIL PROTECTED]
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: Definition
> > >
> > >
> > > Ok, Sorry about that
> > >
> > > Anyway what do you mean perldoc -f qq?
> > >
> > > what does the ~qq mean?
> > >
> > > ----- Original Message -----
> > > From: "fliptop" <[EMAIL PROTECTED]>
> > > To: "Bill Lyles" <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, April 16, 2002 8:53 PM
> > > Subject: Re: Definition
> > >
> > >
> > > > Bill Lyles wrote:
> > > >
> > > > > href="file://C:\Program Files\Common Files\Microsoft
> > > Shared\Stationery\">
> > > > > As I am somewhat new to perl
> > > > >
> > > > > can someone tell me what this means
> > > > >
> > > > > $header = qq~
> > > > >
> > > > > I understand the header but what is the qq~ for?
> > > >
> > > >
> > > > perldoc -f qq
> > > >
> > > > btw, it's considered bad form to send html-ized email to the list.
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> >
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> >
> >
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to