-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to maguowei2723 on 4/13/2009 1:45 AM: > I want to replace all the word of "root" to "administrator" in test.txt > file.I get a bit part of the file: > > > 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. > > USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND > ammi 1 0.0 0.1 2008 768 ? Ss 21:03 0:03 /sbin/inii
tr is for character replacement. You asked it to replace 'o' with 'd', and also asked it to replace 'o' with 'm', and the latter request won. If you want word replacement, you are looking for 'sed', not 'tr'. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknjJzcACgkQ84KuGfSFAYC/DgCfcL9/82ZFrG7DGxvjHA4cmndN Q98An3ubEswlG9M1C4mmqmbqLvc7j7fO =VBVq -----END PGP SIGNATURE----- _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils