LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 909|回复: 3

sed如何删除文件每行的第二字符

[复制链接]
发表于 2007-4-28 12:00:36 | 显示全部楼层 |阅读模式
最好是编写一个sed命令,谢谢!
 楼主| 发表于 2007-4-28 19:55:51 | 显示全部楼层
sed 's/\(.\).\(.*\)/\1\2/' file
可怜,没有人回答,自己看半天书解决了.....................
回复 支持 反对

使用道具 举报

发表于 2007-4-28 21:57:26 | 显示全部楼层
sed 's/\(.\)./\1/g' file
回复 支持 反对

使用道具 举报

发表于 2007-5-1 10:20:35 | 显示全部楼层
Post by 晨想
sed 's/\(.\)./\1/g' file

Don't think this is right. This is actually meaning delete every 2nd char after the matching char, not the samething as deleting THE 2nd char in each line.
  1. /\(^.\)./
复制代码
would be better I think.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表