in reply to Deleting first and last TWO(2) lines of a text file
HEAD=`head -1 myfile.txt` TAIL=`tail -1 myfile.txt` grep -v $HEAD myfile.txt|grep -v $TAIL>myfile.txt~ mv myfile.txt~ myfile.txt
Untested code. Needs some debugging.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Deleting first and last lines of a text file
by AppleFritter (Vicar) on May 16, 2014 at 10:57 UTC | |
Re^2: Deleting first and last lines of a text file
by vsmeruga (Acolyte) on May 16, 2014 at 11:02 UTC | |
by morgon (Priest) on May 16, 2014 at 12:00 UTC | |
by vsmeruga (Acolyte) on May 16, 2014 at 12:36 UTC |
In Section
Seekers of Perl Wisdom