shell学习之二
时间:2008-03-24 来源:yl2003215059
22.185.225.193 = Hex-STRING: 00 17 A4 3A 48 06
222.185.225.194 = Hex-STRING: 00 17 A4 3A B9 EA
222.185.225.195 = Hex-STRING: 00 17 A4 3A ED 96
222.185.225.196 = Hex-STRING: 00 15 60 ED 7B 49
222.185.225.197 = Hex-STRING: 00 15 60 09 F0 EF
222.185.225.198 = Hex-STRING: 00 14 C2 54 F7 F1
222.185.225.199 = Hex-STRING: 00 15 60 09 F0 F7
222.185.225.201 = Hex-STRING: 00 15 60 5F 93 D3
222.185.225.202 = Hex-STRING: 00 15 60 09 F1 41
222.185.225.203 = Hex-STRING: 00 15 60 5F 86 7A
222.185.225.204 = Hex-STRING: 00 15 60 5F 94 13 sed 's/\=.*\://g'这个是把中间那些字符去掉
sed里面那个.是指匹配任意字符 把=和:之间的东西,包括=:这两个替换成空 *是指这个.(任意字符)有0到多个
222.185.225.194 = Hex-STRING: 00 17 A4 3A B9 EA
222.185.225.195 = Hex-STRING: 00 17 A4 3A ED 96
222.185.225.196 = Hex-STRING: 00 15 60 ED 7B 49
222.185.225.197 = Hex-STRING: 00 15 60 09 F0 EF
222.185.225.198 = Hex-STRING: 00 14 C2 54 F7 F1
222.185.225.199 = Hex-STRING: 00 15 60 09 F0 F7
222.185.225.201 = Hex-STRING: 00 15 60 5F 93 D3
222.185.225.202 = Hex-STRING: 00 15 60 09 F1 41
222.185.225.203 = Hex-STRING: 00 15 60 5F 86 7A
222.185.225.204 = Hex-STRING: 00 15 60 5F 94 13 sed 's/\=.*\://g'这个是把中间那些字符去掉
sed里面那个.是指匹配任意字符 把=和:之间的东西,包括=:这两个替换成空 *是指这个.(任意字符)有0到多个
以下以小写转大写为例
(1)sed:
cat file | sed 's/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
(2)tr:
cat file | tr a-z A-Z
(3)perl:
$string="abcdef";
$string =~ tr/[a-z]/[A-Z]/;
or
$string=uc($string); #大小转小写用lc,具体参见perldoc -f lc与perdoc -f uc
相关阅读 更多 +