[GLLUG] tr

Sean picasso@madflower.com
Mon, 30 Sep 2002 12:37:14 -0400 (EDT)


rpl should do it easily. ~  

On Mon, 30 Sep 2002, Melson, Paul wrote:

> I've got a large data file that I need to parse and, for some strange reason, the software that created it replaced each newline character with a printable '\n'.  Fields containing this string need to be rewritten without it for both processing and aesthetic reasons.  I'm leery of using sed because of the "no newlines in search/replace functions" rule and weirdness related to that, so I've been trying to work with `tr`.  According to my understanding of its syntax, this should work:
> 
> tr -s '\134\156' '\040' < dumpfile.txt > newfile.txt
> 
> In this instance, tr uses the octal values for '\' and 'n' and replaces them with the octal value for ' ' (space).  It does what it should do - replaces each '\n' with a ' ', but it's also matching on each 'n' and replacing it with a ' ', which causes a whole new set of problems.
> 
> It seems to me that someone must've run across something like this in the past.  Ideas, suggestions, and slaps upside the head are all appreciated.  Anybody?
> 
> Thanks in advance,
> PaulM
> 
> 
> 
> _______________________________________________
> linux-user mailing list
> linux-user@egr.msu.edu
> http://www.egr.msu.edu/mailman/listinfo/linux-user
>