java替换逗号_在sed中用换行替换逗号

只是为了澄清:OSX上的sed的man-page(10.8; Darwin内核版本12.4.0)说:

[...]

Sed正则表达式

The regular expressions used in sed, by default, are basic regular expressions (BREs, see re_format(7) for more information), but extended

(modern) regular expressions can be used instead if the -E flag is given. In addition, sed has the following two additions to regular

expressions:

1. In a context address, any character other than a backslash (``\'') or newline character may be used to delimit the regular expression.

Also, putting a backslash character before the delimiting character causes the character to be treated literally. For example, in the

context address \xabc\xdefx, the RE delimiter is an ``x'' and the second ``x'' stands for itself, so that the regular expression is

``abcxdef''.

2. The escape sequence \n matches a newline character embedded in the pattern space. You cannot, however, use a literal newline charac-

ter in an address or in the substitute command.

[...]

所以我猜一个人必须使用tr - 如上所述 - 或者漂亮

sed "s/,/^M

/g"

注意:您必须在vi编辑器中键入 -v,才能获得'^M'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值