1. sed with \< and \>
$ echo "To Eric StrToInt" | sed 's/\<To\>/to/g'
to Eric StrToInt
2. sed with \b and \b
$ echo "To Eric StrToInt" | sed 's/\bTo\b/to/g'
to Eric StrToInt
3. perl
$ echo "To Eric StrToInt" | perl -pe 's/\bTo\b/to/g'
to Eric StrToInt
$ sed --version
GNU sed version 4.2.1
... 作者: fangang001 时间: 2014-12-22 14:27
[/ngbss/webapp]echo "To Eric StrToInt" | sed 's/\<To\>/to/'
to Eric StrToInt
[/ngbss/webapp]sh --version
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.作者: w3032084 时间: 2014-12-22 14:43