sed is a third-party command-line tool
You need to download it, the forum seems to have it, OP can search for it yourself
You need to download it, the forum seems to have it, OP can search for it yourself
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Originally posted by abcd at 2007-10-31 12:26 PM:
sed is a third-party command-line tool
You need to download it; the forum seems to have it, OP can search for it yourself
@echo off
for /f "skip=1 tokens=1-6" %%i in (t.txt) do (
set dt=%%m
setlocal enabledelayedexpansion
set dt=!dt:年= !
set dt=!dt:月= !
set dt=!dt:日=!
call :ys "!dt!"
if "!string:~1!" gtr "2007-04-20" if "!string:~1!" lss "2007-10-20" echo %%i %%j %%k %%l %%m %%n
endlocal
)
pause
goto :eof
:ys
set string=
for %%a in (%~1) do (
if %%a leq 9 (set str=0%%a) else (set str=%%a)
set string=!string!-!str!
)
@echo off
setlocal EnableDelayedExpansion
echo Please enter the start date, for example:2007 3 29
set /p d=
call :lis "%d%" d
echo Please enter the end date, for example:2007 10 9
set /p h=
call :lis "%h%" h
set /p var=<a.txt
cls
echo %var%
for /f "delims=" %%i in (a.txt) do (
for /f "tokens=5 delims= " %%a in ("%%i") do (
if not "%%a"=="" (
set num=%%a
set num=!num:年=-!
set num=!num:月=-!
set num=!num:日=!
call :lis "!num!" num
if !num! geq !d! if !num! leq !h! echo %%i
)))
pause
exit
:lis
for /f "tokens=1-3 delims=- " %%a in ("%~1") do (
set m=0%%b
set yy=0%%c
set %2=%%a-!m:~-2!-!yy:~-2!
)
goto :eof