sed命令在macos环境下的使用
最近一直有用 sed 命令来处理文本,感觉蛮有用的记录下来。
首先要保证目标文本都是以行为单位来展示的,也就是每一行都是 sed 的目标处理行。
因为gnu-sed 和 macos 上的 sed 还是有区别的,所以注意自己的版本和查找,gnu-sed 的方法还是多于 macos sed的。If there’s any osx user interested, you can use gsed insted of sed to make it work (install it with macport or brew install gnu-sed)。