[EMAIL PROTECTED] wrote:
> Subject: RE: NewbieQuestion Deleting the first 5 lines of a file
> At 24/01/2003 15:29:27, Bob Showalter
> <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] wrote:
> > > Hello,
> > > 
> > > I have over 1000 files that I need to delete the first five lines
> > > of text from. This needed to be done, like yesterday. I started
> > > writting an Applescript to do this but ran into a bug with Folder
> > > Actions and attached scripts that stopped my progress dead. Would
> > > someone please show me how this is done with perl.
> > 
> > perl -i.bak -ne 'print if $.>5; close ARGV if eof' *.txt
> 
> Hmmm... This leaves me with a backup file and a totally empty
> original file. 

I tested this before posting and tested it again just now, and it works
fine. My platform is FreeBSD.

> Is print sending everything to STDOUT instead of
> writing it to file? 

No, the -i option arranges for the print to go to the file.

The close(ARGV) resets the $. line number between files. See perldoc -f eof
for details.

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

Reply via email to