1
我有一个R统计软件包的脚本,我试图使用SED进行修改。现在,它看起来像这样:如何在使用SED的文本文档中进行搜索和替换?
foo = [something unimportant]
summary(foo)
我想它看起来像:
foo=[something unimportant]
print('foo')
summary(foo)
我已经试过:
sed 's/summary\((.+)\)/print\(\'\1\'\)\nsummary\(\1\)/' <infile.txt >outfile.txt
,但似乎不起作用。我感觉我的正则表达式缺乏。有什么建议么?
美丽。工作完美,谢谢! – Chris