我有这样的文字:
+# This is a comment
+sample text1
+ sample_text1,
+ sample_text2,
+
# This is a comment
Sample text
我打算看到的输出是:
+# This is a comment
+sample text1
+ sample_text1,
+ sample_text2,
# This is a comment
Sample text
如果加号是该行中的唯一字符,我尝试用空格替换加号,但是它将文件中的所有加号替换为空格。我只想选择具有单个加号的行,并用空格替换它。基本上,我想在处理时替换它,而不是实际上在文件中替换。
这是我尝试过的,但不是我打算实现的。 猫文件| tr'+'''