LinuxSir.cn,穿越时空的Linuxsir!

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

[求助] sed -e "s@^@ @"啥子意思

[复制链接]
发表于 2007-11-22 09:46:55 | 显示全部楼层 |阅读模式
如题,查了半天没查到:)
 楼主| 发表于 2007-11-22 10:19:39 | 显示全部楼层
sorry,查到了,原来是@在搜索的时候要用原名啊(at sign),答案如下,希望大家也可以用到:
[addr1[,addr2]]s/expr/string/[flags]
          Searches the indicated lines for a string of characters matching the expression defined by expr, and replaces that set of characters with string. This command's operation is modified by the g, p, and w file flags.[Table Note 4] If either expr or string includes a slash (/), you must escape the literal slash with a backslash (s/path/path\/file/) or use alternative delimiters such as the at sign (@) or question mark (?). For example, s@path@path/file@ replaces path with path/file.
回复 支持 反对

使用道具 举报

发表于 2007-11-22 10:23:09 | 显示全部楼层
简而言之就是作分割符,就不用对regex里的“/”转义了...
回复 支持 反对

使用道具 举报

发表于 2007-12-20 13:00:43 | 显示全部楼层
分隔符不一定必须是 / 的,只要保证三个符号一致就可以。
回复 支持 反对

使用道具 举报

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

本版积分规则

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