

CODE: [Copy to clipboard]不知道楼主说的最后7行是哪7行.findstr /v ~ 123.txt
| Quote: | |
|
| Quote: | |
|
CODE: [Copy to clipboard][ Last edited by HAT on 2008-10-18 at 13:11 ]@echo off
type nul>"%temp%\123_tmp.txt"
for /f "delims=:" %%a in ('findstr /n .* "123.txt"') do (
set RowNum=%%a
)
set /a TarRow=RowNum-7
for /f "tokens=1* delims=:" %%a in ('findstr /n .* "123.txt"') do (
if %%a leq %TarRow% (
set "str=%%b"
setlocal enabledelayedexpansion
if "!str:~0,1!" equ "~" (
echo.!str:~1!>>"%temp%\123_tmp.txt"
) else (
echo.!str!>>"%temp%\123_tmp.txt"
)
endlocal
)
)
findstr "^[0-1][0-9]-[A-Z][A-Z][A-Z]-[0-9][0-9]" "123.txt">>"%temp%\123_tmp.txt"
move /y "%temp%\123_tmp.txt" "123.txt"
CODE: [Copy to clipboard]@echo off
cd.>b.txt
for /f "delims=" %%i in ('type "a.txt"^|find /v /c ""') do set /a n=%%i-5
for /f "tokens=1* delims=:" %%i in ('findstr /n .* a.txt') do (
setlocal enabledelayedexpansion
if not "%%j"=="" (
set str=%%j
set str=!str:*^~=!
>>b.txt echo.!str!
if %%i equ %n% start b.txt&goto :eof
)else >>b.txt echo.
)
pause
| Quote: | |
|

| Quote: | |
|

| Quote: | |
|
CODE: [Copy to clipboard]@echo off&setlocal enabledelayedexpansion
echo.1>nul 3>b.txt
for /f "tokens=1* delims=:" %%i in ('findstr /n .* "a.txt"') do (
set/a n=%%i-7
if not "%%j"=="" set var=%%j
)
for /f "tokens=1* delims=:" %%i in ('findstr /n .* "a.txt"') do (
if not "%%j"=="" (
set str=%%j
set str=!str:*^~=!
echo.!str!
if %%i equ %n% echo !var:~1!&goto end
)else echo.
)
:end
start notepad "b.txt"&exit
| Quote: | |
|
| Quote: |
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |