ASCII File Conversion Unix/NT

It seems that Unix and NT use different hidden control characters to terminate lines in text files. 

Symptoms:

bulletWhen running a Program File, this causes I-DEAS to error out with incompatible control characters.  You will get the message "System read error on line 1 of command input file".
bulletWhen importing a Universal File, I-DEAS will act like it's reading all the lines, but report that "x" lines have been read and "0" processed.

There are some workarounds that will convert the control characters and get the file so that it will read on your system.

Running on Windows NT

If you're running on Windows NT and using a file that exhibits the error message above, then it is very likely that the program file originated on a Unix system.   Although a bit convoluted (and there may be better/easier ways to do this, but I haven't found them yet), you can use the following approach to workaround the problem.

bulletopen the program file in a text editor, e.g. Notepad
bulletSelect All, Copy
bulletExit the text editor
bulletLaunch Microsoft Word and open a new, empty document
bulletPaste -- you should now have all the desired program file text in Word
bulletSelect All
bulletset the Font to Courier New and the Fontsize to very small (say 8 pt)
bulletmove the righthand Ruler as far to the right as possible -- the purpose here is to make sure that no lines wraparound
bulletvisually check to make sure that no lines have wraparound and that no blank lines exist
bulletSave-As, Save as type = Text only with line breaks... "your-desired-name.prg"

Or, Ken Mcintyre of Dart Container offers the following approach:

bulletrename your program file to "program.old"
bulletin ideas, create a new program (e.g. "program.prg") and do anything in it.
bulletIn Wordpad
bulletopen "program.prg" with Wordpad and delete EVERYTHING.
bulletopen "program.old" with Wordpad, select everything(cntrl-A) and copy it (cntrl-C)
bulletswitch to "program.prg" and paste the file in (cntrl-V)
bulletsave program.prg as type "Text"

Ken also makes the following further observations:

bullet

Reading Text Files into I-DEAS (from I-DEAS "readme" file)
"The I-DEAS software requires a carriage-return (<CR>) at the end of ASCII text (*.txt) files, so be sure to press <Return> at the end of the last line in the file if you use Notepad or other editors to edit an I-DEAS text file (and ALWAYS "Save As" a text file)."

bullet

What I found was that:
bullet

this program file will give you the "system read error on line 1" error message:

---------------------------------------
K : #OUTPUT "I'm Here"
E :
---------------------------------------

bullet

but this will not:

---------------------------------------
K : #OUTPUT "I'm Here"
E :

---------------------------------------

(Notice the extra blank line at the very end)

Running on Unix

In this event, it is likely that the program file or universal file was created on Windows and includes hidden "control-M" characters at the end of each line.  You can use a script (typed from the Unix command line) to remove these control characters:

bulletFor Program Files:

perl -pi.bak -0777 -e 's#\r##gi' filename.prg
(where "filename" is the name of your file)

bulletFor Universal Files:

perl -pi.bak -0777 -e 's#\r##gi' filename.unv
(where "filename" is the name of your file)

 

 

back to WAMware homepage®
Copyright © 1996-