HP3000-L Archives

June 2003, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Emerson, Tom" <[log in to unmask]>
Reply To:
Emerson, Tom
Date:
Thu, 26 Jun 2003 09:17:56 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (22 lines)
> -----Original Message-----
> From: Ken Hirsch [mailto:[log in to unmask]]
> Tom Emerson wrote:
> 
> >  tr \r \n <file1 >file2
> 
> That will cause everything to be double-spaced, because "\r\n" will be
> changed to "\n\n".

Hmmm... I didn't catch that -- I thought he wanted to change "just" CR's to "just" LF's, but now that I think of it, I think there are three cases:

  - file contains only CR characters -- "tr \r \n" should fix this

  - file contains only LF characters -- this is the desired result [file is OK]

  - file contains CR/LF pairs -- "tr -d \r" should suffice.  (per the man page, the "-d" flag deletes characters found in "string1")

The final flag for tr is "-s", which consolidates repeated occurances of the first character to a single occurance of the output character.  If only one string is passed as a paramter, repeated occurances of the given character are translated to a single occurance of the same character (i.e., "tr -s \n" would remove the extra linefeed, but this would be a second pass)

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2