似乎应该从每行的开头最多删除2个空格: cat test.txt | 9 sed 's/^ //g
cat test.txt | 9 sed 's/^ //g
注:以下为 9 sed 这里的语法是因为我从plan9port运行它。
9 sed
更详细地说:
$ cat test.txt This is a test. Bye $ cat test.txt | 9 sed 's/^ //g' This is a test. Bye
我希望输出更像是使用GNU sed
sed
$ cat test.txt | sed 's/^ //g' This is a test. Bye
sed 's/^ //g'
好像是(伪代码):
do sed 's/^ //' until the sed output is no longer different from the input
或:
sed 's/^ *//'
g
sed 's/^ //'