Dem text formattin' blues is over!! (Here's the summary)
David Daniel
tronix at polari.UUCP
Mon Oct 1 05:08:24 AEST 1990
Thanks to those who replied to my text formatting question. I was having fits
trying to get the file into a manageable form.
The Hitting The Nail on the Head Award goes to Mr. Chen who pointed out the
two most important facts (see below):
From: sumax!math.berkeley.edu!raymond (Raymond Chen)
Newsgroups: comp.unix.questions
In-Reply-To: <2521 at polari.UUCP>
Organization: U.C. Berkeley
I believe the C654 uses a CR only, whereas UNIX uses a LF only.
So UNIX thinks your document is one huge line.
Solutions:
[1] use emacs, then do a search-and-replace.
[2] Pipe the file through "tr".
Yes indeed, the little C64 gets along quite well with CRs only, while vi wants
a LF and CRs be damned.
Seattle Online is running SCO Xenix and I found that emacs doesn't live here
so I opted for Mr. Chen'#2 suggestion.Before I get into that, I wanted to share something else I discovered while
messing with my errant file: the cat
program has some options that allow you to see what's going on inside an
unruly file. These are the -vte options.
If you type: cat -vte file1 > file2
cat will print non-printing ASCII chrs as well as control and escape codes that
are resident within file1.
That's how I confirmed that my file contained only CRs (they printed as a ^M).
So, once you've figured out what the trouble is you can use tr to remove/replace
the offending bytes.
[caveat: The tr manual is a bit misleading as to syntax. What follows worked
for me, but I had to mess around for a while to get it right.]
tr only wants to hear about ASCII in terms of octal codes (i.e. base eight
numbering). So if you want to talk to tr about an ASCII 10 (LF) or a 13 (CR)
you must use a 012 or a 015 repsectively.
So here's what I had to do to get the CRs out and the LFs in:
tr "\015" "\012" <screwed_up_file >nicely_formatted_file
The '\' is used to prevent any shell confusion along the way.
--
David Daniel (The man with no disclaimer) tronix at polari.UUCP
"Beware the Truth. If you find a Truth it can demand that you make painful
changes." - Frank Herbert
More information about the Comp.unix.questions
mailing list