[X-Unix] Why didn't Apple change the line bre ak ?

Craig A. Finseth fin at finseth.com
Tue Sep 21 09:09:47 PDT 2004


   >This may be unrelated, but why is it that on OS X, if you redirect the 
   >output of
   >ls or some other commands into a text file then open the file with a 
   >text editor,
   >you see something like this:
   >
   >[01;34malias sketchbook examples[0m
   >[0mls.txt[0m
   >[01;34mnew pix[0m
   >[0moreilly.com -- Online Catalog- PDF Hacks.webloc[0m
   >[0mwiretap.sit[0m
   >[0mzip code article-LVRJ.html[0m
   >[0mzip code map-LVRJ.gif[0m
   >[m

   Because, as Eugene pointed out, your text editor sucks.  Get a
   decent one like BBEdit or TextWrangler.  Even Apple's bundled
   TextEdit will handle most line endings correctly.

This is the correct answer to a different question.

   Output from most UNIX command line tools will use UNIX line endings
   (LF).  The cat tool just outputs the contents of the input,
   verbatim.  Byte for byte.  No changes.  If the source file had DOS
   line endings, the output will have DOS line endings.

True, but not the right answer to this question.

You are using a screen editor such a vi or emacs, right?  What you are
seeing is the cursor positioning and screen editing commands.  Note
the:

	[ 0 m

which follows a non-printing ^[ character.  There no doubt others that
you aren't seeing (which is fine...they aren't intended for you to
see).

The editor is using cursor positioning to display the file and the
results of the edits.

Craig



More information about the X-Unix mailing list