Chetak Sasalu wrote:
> 
> Chetak Sasalu wrote:
> >
> > I want to search for the word "status" in a group of files in a
> > directory and replace it with "status\n^L" where ^L is a page break
> > chatacter, In vi I can type it in using cntrl+l.
> >
> > I want to do this by
> >
> > perl -p -i.old -e 's/^STATUS$/STATUS\n(page break character)/' *
> >
> > How can I "write" the page break character (^L) on command line?
> 
> I have one more requirement, The last STATUS which occurs just prior to
> the file end should not be followed by a page break character. How can I
> code this in perl?

That is going to be a little more difficult.  If you can fit the file(s)
into memory then:

perl -i.old -0777pe's/^STATUS$(?=.*?STATUS)/STATUS\n\f/sgm' *



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to