Computing.Net > Forums > Unix > Strip header and footer record?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Strip header and footer record?

Reply to Message Icon

Name: Al
Date: July 15, 2002 at 14:16:11 Pacific
Comment:

Hi,

I need to strip the first line and last line from a text file. Can anyone suggest a nice way to do this with little code?

Thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: Frank
Date: July 15, 2002 at 23:35:48 Pacific
Reply:

Hi Al,

hope it is short enought.

wc -l file |awk '{print $1-1}' |xargs -i head -{} file | sed -n '2,$p'

No RISK no fun

Frank


0

Response Number 2
Name: James Boothe
Date: July 16, 2002 at 07:21:01 Pacific
Reply:

sed "1d;\$d" myfile


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Strip header and footer record?

Add header and footer www.computing.net/answers/unix/add-header-and-footer/8498.html

Deletion of header trailor records www.computing.net/answers/unix/deletion-of-header-trailor-records-/5779.html

split a file with headers and trail www.computing.net/answers/unix/split-a-file-with-headers-and-trail/8235.html