作者:zhanhailiang 日期:2012-12-11
转换命令是sed特有的,不仅因为它在所有的sed命令中拥有最小的助记符。这个命令按位置将字符串abc中的每个字符,都转换成字符串xyz中的等价字符,它的语法如下:
[address]y/abc/xyz/
zhanhailiang@linux-06bq:~> sed -e "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/" test JOHN DAGGETT, 341 KING ROAD, PLYMOUTH MA ALICE FORD, 22 EAST BROADWAY, RICHMOND VA JOHN DAGGETT, 341 KING ROAD, PLYMOUTH MA JOHN DAGGETT, 341 KING ROAD, PLYMOUTH MA JOHN DAGGETT, 341 KING ROAD, PLYMOUTH MA ALICE FORD, 22 EAST BROADWAY, RICHMOND VA