我正在学习SED,我看到了这个sed替代示例。应该在每个新行中将第一个小写的t替换为大写。
$ sed 's/t/T' text-01.txt
sed: -e expression #1, char 5: unterminated `s' command
文件内容:
$ cat text-01.txt
10 tiny toes
this is that
5 funny 0
one two three
tree twice
这还不是世界的尽头,因为我可以输出到一个新文件中:
cat text-01.txt | sed 's/t/T/' > text-02.txt
但是如果我想编辑原始文件该怎么办?
答案 0 :(得分:0)
命令不一样,第一个命令中缺少结尾/
:
# v
sed 's/t/T' text-01.txt
cat text-01.txt | sed 's/t/T/' > text-02.txt
# ^