这是我的代码;“test.txt”文件包含更多的空行和除选项卡之外的空白空间。我也想删除那个空白空间和空行,但在开始之前我需要一个空行st^
。怎么做?
sed "s/^[ ]*//" -i test.txt
cat $2 > /tmp/tt.txt
sed '/^$/d' test.txt > /tmp/tt.txt
echo " " >> test.txt
echo " " >> /tmp/tt.txt
mv /tmp/tt.txt test.txt
我得到如下输出:
st^flower
p^rose
p^jasmine
st^animals
p^bear
p^elephant
我想要像这样的输出:
st^flower
p^rose
p^jasmine
st^animals
p^bear
p^elephant