I'm trying to figure out a better way to do this. Given: I have some EBCDIC text files on Linux. Instead of being delimited with 0x25 (NewLine) instead of 0x15 (linefeed). This is how z/OS UNIX does text files and I cannot change it. When run through iconv the 0x25 is translated to 0x85, but I need 0x0a. I end up doing a "tr '\205' '\n' in order to end up with 0x0a in the ASCII file. Note that when I do an ASCII ftp from z/OS, it is doing the conversion "correctly" (defined as what I want). However, I don't want to do this. The file being transferred is a PAX file which contains true binary as well as text files. So what I'm really doing is like (after using tar to unwind the PAX file):
for i in *;do file "$i" | fgrep -q EBCDIC && cnv "$i";done (yes, the fgrep actually does select the files that I want without, so far, any false positives or negatives) where cnv is a shell script: #!/bin/sh iconv -f ISO8859-1 -t ISO8859-1 "$1" |\ tr '\205' '\n' >"$1.new" chmod --reference="$1" "$1.new" mv "$1" "$1.org" mv "$1.new" "$1" This works but is not, IMO, "elegant". Any better ideas how to do this? Many thanks! -- John McKown Maranatha! <>< ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390
