in reply to Re: Deleting first and last lines of a text file
in thread Deleting first and last TWO(2) lines of a text file
Hi I tried with below code calling scripts as ./scriptname srcfile.txt. But it deleted just the first line. Not last 2 lines/1 line </p?
#!/usr/bin/perl my $file='jjl.exec.txt'; open STDOUT, ">", $file or die "$0: open: $!"; open STDERR, ">&STDOUT" or die "$0: dup: $!"; <>; while($line = <>) { print if defined; $_ = $line; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Deleting first and last lines of a text file
by AppleFritter (Vicar) on May 16, 2014 at 19:00 UTC |