Hi,
I am getting a data file into Unix box and it is generated using COBOL.
The file has Header and footer repeating every page, my objective is to eliminate header and footer and process records between them.
I used sed command to delete Header but the real problem is the previous record is also deleted with header.
When I open the file in vi editor i could see ^L (in blue) between the previous record and header.
I got to know ^L stands for new form.
I need help eliminating header without deleting any records.
Thank you in advance.
Deleting header of Data file In UNIX
Moderators: chulett, rschirm, roy
Deleting header of Data file In UNIX
Thanks & Regards,
Sri
Sri
Sed command I used
I used
sed -e "/Header Start/,/End Word/d" orginalfile.dat>newfile.dat
This will search for 'headerStart' and delete lines till it reaches 'endword'.
using this command I have deleted the all header instances and saved into newfile.
FYI we put /Header Start/,/End Word/d in double quotes (as in above statement) if the 'Start Word' or 'End Word' have spaces in between.
sed -e "/Header Start/,/End Word/d" orginalfile.dat>newfile.dat
This will search for 'headerStart' and delete lines till it reaches 'endword'.
using this command I have deleted the all header instances and saved into newfile.
FYI we put /Header Start/,/End Word/d in double quotes (as in above statement) if the 'Start Word' or 'End Word' have spaces in between.
Thanks & Regards,
Sri
Sri
I'm no sed expert, but you could put in
Code: Select all
sed -e 's/\o014/\o015/' -e "/Header Start/,/End Word/d"
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: ArndW
ArndW wrote:I'm no sed expert, but you could put in...Code: Select all
sed -e 's/\o014/\o015/' -e "/Header Start/,/End Word/d"
Tried the sed command given by you, still deleting the record before the header.
Thanks & Regards,
Sri
Sri