Files without NewLine Characters
On UNIX, files can contain NewLine (nl) characters at the end of each line. However, the NewLine characters are optional. Some files have them. Others don't.
Qedit/UX requires that lines be separated by a NewLine (NL) character. If that's not the case, Qedit/UX assumes the file does not contain anything. Thus, the Text command might display:
/Text longfile
'Language' is now DATA
0 lines in file
If you run into this problem, you have to find a way to insert these NewLine characters in appropriate places and break the file into manageable pieces.
Starting with version 5.3.13 of Qedit/UX, you can use the Length option of the Text command. This option allows you to specify the maximum size in bytes of each line. The file will be split in a number of same-size lines except the last one if the total size of the file is not evenly divisable by the specified length.
If the file contains Newline characters, these characters are processed as data. You should be very careful when editing such files. If you inadvertently remove one or more of these characters, other programs might have problems using the file again. Since Newline characters causes terminals to move to the next line, we recommend that you use the $Char or the $Hex option on List commands.
For example, to break a file into 80-byte lines, you should use:
/Text longfile,length 80
Another way to accomplish this is by using the fold
command.
fold -w 80 longfile > shortfile
In this example, the file longfile
is broken down into fixed-length lines, each line containing a maximum of 80 bytes. The result is written to a new file called shortfile
. It is then possible to edit the new file using Qedit/UX.
Once you have made all the necessary changes, you can put the short lines back together by removing the NewLine characters. You can use the UNIX awk
to perform this operation.
awk -v ORS="" '{ print $0 }' shortfile > longfile
The Output Record Separator (ORS
) argument is used to specify the character to be inserted between lines. In this case, you don't specify any.
Because of a limitation in awk, you cannot assemble lines with more than 3,071 bytes. So, you have to remember not to exceed this maximum in the fold command.
Another option is to use the UNIX tr
command and remove all Newline characters.
tr -d "/n" < shortfile > longfile
![Home](rnd2hm_s.gif)
![Previous](rnd2pr_s.gif)
![Next](rnd2nx_s.gif)