Eliminate Header and footer from EBCDIC file


 
Thread Tools Search this Thread
# 2  
Old 12-17-2014
Well, the general example would be:
Code:
sed '1d' file > file1 && sed '$d' file1 > NoHeaderAndFooter

but in your case it's EBCDIC file, so it's not a simple text file?
If it's the case of removing the first 24 bytes, please elaborate further.
# 3  
Old 12-17-2014
If you're on a system where all of the data is in EBCDIC, your sed commands (or the single command:
Code:
sed -e '1d' -e '$d' file > NoHeadAndFooter

which would be faster) should work just fine.

Otherwise use dd or iconv to convert file from EBCDIC to your system's native codeset and then run your sed command(s) on the converted file.
# 5  
Old 12-18-2014
I suggested using dd or iconv. Did you try either of them? Is the data from your mainframe in fixed length records. If so use something like:
Code:
dd if=YourInputFile conv=ascii cbs=FixedLengthRecordSize

If not, use something like:
Code:
iconv -f fromcode YourInputFile

where fromcode is a code chosen from the output of the command:
Code:
iconv -l

for an EBCDIC codeset.
 

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Split large xml into mutiple files and with header and footer in file karthik Shell Programming and Scripting 36 21 Hours Ago 01:33 AM
Removing Header and Trailer record of a EBCDIC file abhilashnair UNIX for Advanced & Expert Users 1 06-11-2015 08:30 AM
File Row Line Count without Header Footer gagan8877 UNIX for Dummies Questions & Answers 7 05-02-2013 02:29 PM
Is there a way to append both at header and footer of a file jediwannabe Shell Programming and Scripting 3 02-28-2013 06:57 AM
Removing header or footer from file sridhardwh Shell Programming and Scripting 5 06-04-2012 06:43 AM
Add header and footer with record count in footer itsranjan Shell Programming and Scripting 1 03-25-2012 12:45 AM
Removing header and footer Tom Sawyer Shell Programming and Scripting 1 03-07-2012 11:26 AM
Header and Footer... suresh_target Shell Programming and Scripting 1 02-15-2012 04:44 AM
sort a report file having header and footer suryanarayana Shell Programming and Scripting 4 11-25-2011 10:48 PM
Ignore Header and Footer and Sort the data in fixed width file sasikari Shell Programming and Scripting 5 07-14-2011 12:42 PM
How to add header and footer? ken002 Shell Programming and Scripting 4 11-22-2010 11:23 PM
Split large file and add header and footer to each small files ashish4422 Shell Programming and Scripting 7 07-07-2008 03:13 PM
Split large file and add header and footer to each file ashish4422 Shell Programming and Scripting 1 04-15-2008 07:12 AM
Total of lines w/out header and footer incude for a file gzs553 Shell Programming and Scripting 1 11-16-2006 07:42 PM
Need to Chop Header and Footer record from input file coolbudy Shell Programming and Scripting 4 08-09-2005 01:26 PM