F9.TXT has
1
2
3
5
7
8
-------------------------------------------------------------
SET K1=F9.TXT
REM these two lines just below are not from me, you may ignore them, cause i dont understand ^ well
For /F tokens^=*^ delims^=^ eol^= %%I in ('TYPE "%K1%"') do echo. %%I
For /F tokens^=*^ delims^=^ eol^= %%I in ("C:\F9.TXT") do echo. %%I
REM --------------------------------------------------------
SetLocal EnableExtensions EnableDelayedExpansion
FOR /F "DELIMS=" %%V IN ('TYPE "%K1%"') DO (
SET VV=%%V
ECHO !VV!
)
ECHO.
FOR /F "Tokens=*" %%V IN ('TYPE "%K1%"') DO (
SET VV=%%V
ECHO !VV!
IF /I "!VV!"=="" ECHO.
IF /I "!VV:~0!"=="" ECHO.
PAUSE
but this batch displays
1
2
3
5
7
8
how do i make the empty lines as output as well as they were intended
all 4 for do loops do not display empty lines
how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
Moderator: DosItHelp
how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
Last edited by nnnmmm on 03 Oct 2024 00:59, edited 1 time in total.
Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
Maybe:
Saso
Code: Select all
type f9.txt
Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
i need to put corrected line numbers and control its contents, i left them out to show my problem at the moment
i need empty lines to group them in a way
these will be added later
SET /A CC=!CC!+1
IF !CC! GEQ 1 IF !CC! LEQ 9 SET DD= !CC!
IF !CC! GTR 9 SET DD=!CC!
IF /I "!VV:~0,10!"=="http://www" (SET C1=1)&(ECHO [32m!DD! !VV:~11,%DS2%![0m)
IF /I "!VV:~0,11!"=="https://www" (SET C1=1)&(ECHO [31m!DD! !VV:~12,%DS2%![0m)
IF /I "!VV:~0,9!"=="ftp://ftp" (SET C1=1)&(ECHO [35m!DD! !VV:~10,%DS2%![0m)
IF /I "!C1!"=="0" (ECHO [36m!DD! !VV:~7,%DS2%![0m)
i need empty lines to group them in a way
these will be added later
SET /A CC=!CC!+1
IF !CC! GEQ 1 IF !CC! LEQ 9 SET DD= !CC!
IF !CC! GTR 9 SET DD=!CC!
IF /I "!VV:~0,10!"=="http://www" (SET C1=1)&(ECHO [32m!DD! !VV:~11,%DS2%![0m)
IF /I "!VV:~0,11!"=="https://www" (SET C1=1)&(ECHO [31m!DD! !VV:~12,%DS2%![0m)
IF /I "!VV:~0,9!"=="ftp://ftp" (SET C1=1)&(ECHO [35m!DD! !VV:~10,%DS2%![0m)
IF /I "!C1!"=="0" (ECHO [36m!DD! !VV:~7,%DS2%![0m)
Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
This is your f9.txt
change the empty lines with the ALT+08 char (BackSpace) and run
For /f "tokens=*" %%a in ('type %k1%') do echo.%%a
Code: Select all
1
2
3
5
7
8
For /f "tokens=*" %%a in ('type %k1%') do echo.%%a
Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
>>change the empty lines with the ALT+08 char (BackSpace)
i cant use ALT+08 as the end of line marker,
because i am already using "-" as a marker for a temporary improvisation, "-" is easier than ALT+08
thanks for trying to help
it seems no-go, i will adapt using "-"
i will close this issue, i may ask this again maybe few years later
1
2
3
-
5
-
7
8
i cant use ALT+08 as the end of line marker,
because i am already using "-" as a marker for a temporary improvisation, "-" is easier than ALT+08
thanks for trying to help
it seems no-go, i will adapt using "-"
i will close this issue, i may ask this again maybe few years later
1
2
3
-
5
-
7
8
Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
If you can use external tools: gsar maybe? you replace CRLFCRLF with something like '#' (or another character you don't have in an input file (you mention '-')).
Saso
Saso
Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?
Or ...
Use FINDSTR with line numbering and work from there:
Use FINDSTR with line numbering and work from there:
Code: Select all
T:\>findstr /n /r "^" f9.txt
1:1
2:2
3:3
4:
5:5
6:
7:7:5\;5:6
8:8
9:
T:\>for /f "usebackq tokens=1,* delims=:" %i in (`findstr /n /r "^" f9.txt`) Do @echo __%j__
__1__
__2__
__3__
____
__5__
____
__7:5\;5:6__
__8__
____
T:\>