开发者

Removing leading spaces in a text file

I have a bunch of texts files although they all have spaces at the beginning of lines

e.g.

 testing 123
 download
 upload

wo开发者_如何学Culd be

testing 123
download
upload

Preferably using a utility such as grep etc.


sed -i -e's/^\s*//' yourfilenamehere


You can use sed

sed 's/^ *//' file

This should work with Linux and your GNUWin Toolkit.

echo "     Line starting with spaces" | sed 's/^[ \t]*//'


perl -pi -e 's/^\s+//' yourfilenamehere
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜