中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-11-24 06:32
47,820 topics / 349,938 posts / today 0 new / 48,298 members
DOS批处理 & 脚本技术(批处理室) » New space deletion problem??
Printable Version  3,484 / 40
Floor31 26933062 Posted 2008-05-29 23:04
银牌会员 Posts 879 Credits 2,268

Also, please trouble again: Why not add a .* at the end, in the form of ".*\.*", what is the difference between this and not adding it?
...

.*\ just matches if the conditions are met, so it doesn't matter if there is content after the
Adding .* after means it matches whether there is content after the or not.
But if it is ". *\..*", it's different. It means there must be at least one character after the
Reply to floor 27: eol=;

[ Last edited by 26933062 on 2008-5-29 at 11:06 PM ]
Floor32 WANKOILZ Posted 2008-05-29 23:18
初级用户 Posts 89 Credits 198 From 重庆
Oh, that is, .*\[..*\] just needs to meet the conditions to match, I got it, thank you very much. Does for /f not ignore lines starting with ; by default?
Floor33 amio Posted 2008-05-29 23:21
中级用户 Posts 93 Credits 206
Why does the empty line of [ not become empty anymore? It only deletes the ; and all spaces.
@echo off
for /f "delims=:" %%a in ('findstr /n ".*\[..*\]" a.txt') do set .%%a=a
for /f "tokens=1* delims=:" %%a in ('findstr /n .* a.txt') do (
if defined .%%a echo.
for /f "tokens=*" %%i in ("%%b") do echo.%%i>>temp.txt
)
Floor34 amio Posted 2008-05-29 23:24
中级用户 Posts 93 Credits 206
Originally posted by zqz0012005 at 2008-5-29 11:01 PM:
If you add a .* later, then lines like add that don't end with ] will also be matched, and such lines are not what the楼主 wanted, right?


Lucky! There are no such things in the file I modified.
Floor35 WANKOILZ Posted 2008-05-29 23:28
初级用户 Posts 89 Credits 198 From 重庆
Adding or not adding .* both match [reg]add. Because .* can be nothing, but ..* means there must be at least one character.
Floor36 amio Posted 2008-05-29 23:34
中级用户 Posts 93 Credits 206
Hope brother 26933062 gives another complete code

[ ; Also, there are spaces in front of each line of characters, and all other spaces except [ are deleted ...............
Floor37 26933062 Posted 2008-05-29 23:36
银牌会员 Posts 879 Credits 2,268
Originally posted by amio at 2008-5-29 23:34:
Hope brother 26933062 gives a complete code again.




Your changes are too many. You solve one and another comes.
Moreover, I can't understand the simplified language above you.
Floor38 amio Posted 2008-05-30 13:51
中级用户 Posts 93 Credits 206
Originally posted by 26933062 at 2008-5-29 11:36 PM:

You've changed too much, one problem solved and another comes up.
Moreover, I can't understand the previous Jianyu.


@echo off
for /f "delims=:" %%a in ('findstr /n ".*\" a.txt') do set .%%a=a
for /f "tokens=1* delims=:" %%a in ('findstr /n .* a.txt') do (
if defined .%%a echo.
for /f "tokens=*" %%i in ("%%b") do echo.%%i
)

This code basically already achieves what I said. How to output?
Floor39 WANKOILZ Posted 2008-05-31 12:21
初级用户 Posts 89 Credits 198 From 重庆
Back to the upstairs, dizzy!!
@echo off
for /f "delims=:" %%a in ('findstr /n ".*\[..*\]" a.txt') do set .%%a=a
for /f "tokens=1* delims=:" %%a in ('findstr /n .* a.txt') do (
if defined .%%a echo.>>a.txt
for /f "tokens=*" %%i in ("%%b") do echo.%%i>>a.txt
)

Just add >> after echo........
Floor40 amio Posted 2008-05-31 12:52
中级用户 Posts 93 Credits 206
Originally posted by WANKOILZ at 2008-5-31 12:21 PM:
Reply to the above, dizzy!!
@echo off
for /f "delims=:" %%a in ('findstr /n ".*\" a.txt') do set .%%a=a
for /f "tokens=1* delims=:" %%a in ('findstr /n .* a.txt') do (
...


I tried this, some functions can't be fully implemented
Floor41 FQ Posted 2008-05-31 13:29
社区乞丐 Posts 37 Credits -61
Trim left and right spaces:
3.txt

Test code:
Prev  1 2 3
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023