[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug report of tr command.
From: |
Mike Frysinger |
Subject: |
Re: Bug report of tr command. |
Date: |
Mon, 13 Apr 2009 07:56:15 -0400 |
User-agent: |
KMail/1.11.1 (Linux/2.6.28; KDE/4.2.1; x86_64; ; ) |
On Monday 13 April 2009 03:45:54 maguowei2723 wrote:
> I want to replace all the word of "root" to "administrator" in test.txt
> file.I get a bit part of the file:
>
> root 1 0.0 0.1 2008 768 ? Ss 21:03 0:03 /sbin/init
> root 2 0.0 0.0 0 0 ? S< 21:03 0:00 [kthreadd]
> root 3 0.0 0.0 0 0 ? S< 21:03 0:00
> [migration/0] root 4 0.0 0.0 0 0 ? S< 21:03
> 0:00 [ksoftirqd/0]
>
> yeah,but when I finish the replace by execute command---- tr 'root'
> 'administrator' < test.txt I found the result is not the same with my
> expected.
please read the description of tr again. it does not convert one string to
another, it converts a set of characters to another. so you told it to
convert the output by doing:
r -> a
o -> m
t -> i
...
if you want to do string replacement, use sed.
-mike