I am looking for how to keep blank lines when viewing a file with a for loop.
for /f "tokens=1* delims=[" %%i in ('type "test1.txt" ^| find /v /n ""') do (
SET tmp=%%i
echo !tmp! >> test2.txt
)
Actually it works for everyone, but as I understand it, it does not work. For example, if the contents of test1.txt:
Hello I come from France
I live in Paris
I'm sorry I don't know english, could we speak french please ?
If it doesn't bother you
Thank you
The result in test2.txt will be:
[1
[2
[3
[4
[5
[6
[7
If I put "1" near the star "*", the result:
[1]Hello I come from France
[2]I live in Paris
[3]
[4]I'm sorry I don't know english, could we speak french please ?
[5]If it doesn't bother you
[6]
[7]Thank you
Required Conclusion:
Hello I come from France
I live in Paris
I'm sorry I don't know english, could we speak french please ?
If it doesn't bother you
Thank you
Could you help me solve this problem?
Many thanks.
source
share