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 _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils