Page 1 of 1

how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?

Posted: 02 Oct 2024 19:58
by nnnmmm
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

Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?

Posted: 02 Oct 2024 22:54
by miskox
Maybe:

Code: Select all

type f9.txt
Saso

Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?

Posted: 03 Oct 2024 00:57
by nnnmmm
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)

Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?

Posted: 03 Oct 2024 08:25
by Lucky4Me
This is your f9.txt

Code: Select all

1
2
3

5

7
8
change the empty lines with the ALT+08 char (BackSpace) and run

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?

Posted: 03 Oct 2024 20:43
by nnnmmm
>>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

Re: how do i display empty lines with maybe DELIMS and TOKENS for TYPE command?

Posted: 03 Oct 2024 21:57
by miskox
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