The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
remove a line within a file new2ss UNIX for Dummies Questions & Answers 3 1 Week Ago 11:34 AM
sed remove last 10 characters of a line start from 3rd line minifish Shell Programming and Scripting 7 03-26-2008 01:42 PM
Copy all the files with time stamp and remove header,trailer from file ksrams UNIX for Dummies Questions & Answers 35 07-30-2007 11:15 AM
How to remove last line of the file mani_um Shell Programming and Scripting 3 05-14-2007 05:35 AM
Remove every third line from a file bistru Shell Programming and Scripting 4 01-31-2006 04:26 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-13-2006
Registered User
 

Join Date: Nov 2005
Posts: 91
Remove header(first line) and trailer(last line) in ANY given file

Hi,

I need some help in removing the header (first line) and the trailer (last line) in a give file...

The data file actually comes in EBCDIC format and I converted it into ASCII..
Now I need to strip off the first line and the last line..

I think we can use sed to do something like this:

sed -n -e '2,964p' InPutFile.dat > OutPutFile.dat

Since I know the file has 965 rows, I could do this...But I would like to automate this script..

Thank you,
Madhu
Reply With Quote
Forum Sponsor
  #2  
Old 03-13-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,656
Try:
sed '1d;$d'
Reply With Quote
  #3  
Old 03-13-2006
Registered User
 

Join Date: Nov 2005
Posts: 91
Thank you for the message. I was just wondering if we can do the same thing on EBCDIC data file which is fixed width. Can we remove the lines depending on the number of bytes in an EBCDIC file? Like remove 23 bytes in the beginning and 8 bytes at the end...

Thanks again,
Madhu
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0