Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reformat EBCDIC file 1

Status
Not open for further replies.
Oct 10, 2003
2,323
US
I have a short EBCDIC file. Just think of it as a string of bytes of length 68250. I need to change the header record on that EBCDIC file, which is in the beginning of that string of bytes. I need to swap the position of two 8 byte fields. What am I doing wrong? Linux GNU Awk 3.1.7

awk `substr ($0,1,5) substr ($0,14,8) substr($0,6,8) substr($0,22,68250)` csus.tsys.stmtaddr.00.dy.sa.20140204.dat > csus.tsys.stmtaddr.00.dy.sa.20140204.new


==================================
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright


 
Perhaps this ?
awk '{print substr ($0,1,5) substr ($0,14,8) substr($0,6,8) substr($0,22)}' csus.tsys.stmtaddr.00.dy.sa.20140204.dat > csus.tsys.stmtaddr.00.dy.sa.20140204.new

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Ah, what was deeply muddy on Friday afternoon is abundantly clear when one needs to work overtime on a Saturday - thanks PHV.

==================================
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top