The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
delete n last lines of a file
User Name
Remember Me?
Password
Google UNIX.COM
Forums
Portal
Register
Rules & FAQ
Contribute
Members List
Arcade
Search
Today's Posts
Mark Forums Read
Thread
:
delete n last lines of a file
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
#
5
(
permalink
)
04-18-2008
radoulov
addict
Join Date: Jan 2007
Location: Milan, Italy/Varna, Bulgaria
Posts: 1,432
Or:
Code:
perl -0777pe's/(?:.*\n){10}\z//' file
Or in-place with ed:
Code:
printf '$-9,$d\nw'|ed - file
radoulov
View Public Profile
Find all posts by radoulov