[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with the tr command

From: George Herson
Subject: problem with the tr command
Date: Wed, 13 Jun 2001 10:13:04 -0400

hi.  I can't seem to get the tr command to translate carriage returns to
line feeds. I first tried specifying these in octal (tr \15 \12) and
then, using \r and \n (shown below).  Neither works.  \r seems to be
interpreted by tr as "r" and \n, as "n", contrary to what tr's help text
specifies (shown below).

Is this behavior a bug?  


# tr --help|more
Usage: tr [OPTION]... SET1 [SET2]
Translate, squeeze, and/or delete characters from standard input,
writing to standard output.
SETs are specified as strings of characters.  Most represent themselves.
Interpreted sequences are:

  \NNN            character with octal value NNN (1 to 3 octal digits)
  \\              backslash
  \a              audible BEL
  \b              backspace
  \f              form feed
  \n              new line
  \r              return

# cp /tmp/junk.b2 /tmp/junk.b3
# cat /tmp/junk.b2 | tr \r \n >/tmp/junk.b3
# cmp -c /tmp/junk.b2 /tmp/junk.b3
/tmp/junk.b2 /tmp/junk.b3 differ: char 28, line 2 is 162 r 156 n

# cat /tmp/junk.b2             
echo "hello world"
# cat /tmp/junk.b3 
echo "hello wonld"

# tr --version
tr (GNU textutils) 2.0a
Written by Jim Meyering.

# uname -a
Linux geodollar.com 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686

reply via email to

[Prev in Thread] Current Thread [Next in Thread]