Linux, programming, computers and life

September 12, 2007

delete first and last lines from a file using sed

Filed under: CLI, programming, awk

I tried do do it using awk, but i did not find an easy way to determine the last line in file. So sed did the trick:

cat myFile | sed '1 {d}; $ {d}' > myNewFile

Technorati Tags: , , ,

Comments »

The URI to TrackBack this entry is: http://linux4all.blogsome.com/2007/09/12/delete-first-and-last-lines-from-a-file-using-sed/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Gary Rogers