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.
我想使用批处理脚本删除 .txt 文件的最后一个空白行。我的最后一行将始终为空白。
使用sed:
sed '$d' in
$表示最后一行,d表示删除匹配的模式。
如果您的输出文件只有一个空行,而空行是指空行 - 不包含任何字符,则作为批处理文件命令:
for /f "delims=" %%i in (sqloutfile.txt) do >>newfile.txt echo %%i
或者根据提示,
for /f "delims=" %i in (sqloutfile.txt) do >>newfile.txt echo %i