The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 03-19-2009
ddrew78 ddrew78 is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 8
Re: Find line before blank

summer cherry,

here is what I ended up with in my script:

#!/usr/bin/perl

open $fh,"<","myfile";
open $out,">>","mynewfile";
undef $/;
$str=<$fh>;
print $out split(/\n^$\n^$\n/s,$str,2)[0];

I got the error message below. Any ideas? I appreciate the help.

syntax error at ansipre2 line 7, near ")["
Execution of ansipre2 aborted due to compilation errors.