On May 20, 4:37 am, cmksw...@gmail.com (Ambuli) wrote:
> Here i paste a perl script to delete last Two Lines. If you want
> delete more lines in a file you can specify it.
>
> use File::ReadBackwards;
> my $filename = 'test.txt';
> my $Lines_to_truncate = 2; # Here the line to truncate is mean Re
Hi Ambuli,
a few comments on your code:
On Friday 20 May 2011 14:37:52 Ambuli wrote:
> Here i paste a perl script to delete last Two Lines. If you want
> delete more lines in a file you can specify it.
>
>
Always start with "use strict;" and "use warnings".
> use File::ReadBackwards;
Include
Smith, Derek wrote:
I want to use truncate to delete a matched line out a named.conf file on
my DNS box.
Here is my code
As others have said, this will lop off the end of the file.
Another option is to run perl -i and edit the file in place.
while(<>){ print if /Acheck\-names/ }
But under
On Sun, 2006-23-04 at 17:07 -0400, Smith, Derek wrote:
> This does not work as my file still contains both lines.
> check-names warn;
> fooy
>
> when I want it to only contain
> fooy
That's not what truncate does. It chops off the end of the file. What
you have to do is copy the contents to a tem
-Original Message-
From: Mr. Shawn H. Corey [mailto:[EMAIL PROTECTED]
Sent: Sunday, April 23, 2006 1:51 PM
To: Perl Beginners
Subject: Re: truncate
On Sun, 2006-23-04 at 13:29 -0400, Smith, Derek wrote:
> use strict;
>
> use warnings;
>
>
>
> my $file = qq(
Smith, Derek wrote:
I want to use truncate to delete a matched line out a named.conf file on
my DNS box.
Here is my code
use strict;
use warnings;
my $file = qq(/usr/local/admin/perl/derek_perl/test);
open (FH, "+< $file");
while ( ) {
unless (/\Acheck\-names/) {
On Sun, 2006-23-04 at 13:29 -0400, Smith, Derek wrote:
> use strict;
>
> use warnings;
>
>
>
> my $file = qq(/usr/local/admin/perl/derek_perl/test);
>
> open (FH, "+< $file");
>
>while ( ) {
>
> if (/\Acheck\-names/) {
>
> my $addr=tell(FH);
if( $addr < 0
Gunnar Hjalmarsson wrote:
John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have a file which contains a number of instances of the word
"FINAL". I need to truncate all the instances of this word and
create an output string of the rest of the words in the same line
in the file. Rest all lines not con
John W. Krahn wrote:
[EMAIL PROTECTED] wrote:
I have a file which contains a number of instances of the word
"FINAL". I need to truncate all the instances of this word and
create an output string of the rest of the words in the same line
in the file. Rest all lines not containing the word are to be
[EMAIL PROTECTED] wrote:
Hi
Hello,
I have a file which contains a number of instances of the word "FINAL".
I need to truncate all the instances of this word and create an output
string of the rest of the words in the same line in the file. Rest all
lines not containing the word are to be ignored. F
On Sep 20, [EMAIL PROTECTED] said:
>I have a file which contains a number of instances of the word "FINAL".
>I need to truncate all the instances of this word and create an output
>string of the rest of the words in the same line in the file. Rest all
>lines not containing the word are to be ignor
11 matches
Mail list logo