欲删除文本内容,仅保留最后一行,代码如何修改?复制代码
- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /a-d /b *.txt') do (
- set /p str=<"%%i"
- >"%%i" echo;!str!
- )
- pause
复制代码
- sed -i "$!d" *.txt
欢迎光临 批处理之家 (http://www.bathome.net/) | Powered by Discuz! 7.2 |