Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一堆文本文件,尽管它们在行首都有空格
例如
testing 123 download upload
将会
最好使用 grep 等实用程序。
perl -pi -e 's/^\s+//' yourfilenamehere
sed -i -e's/^\s*//' yourfilenamehere
您可以使用sed
sed
sed 's/^ *//' file
这应该适用于 Linux 和您的 GNUWin 工具包。
echo " Line starting with spaces" | sed 's/^[ \t]*//'