|
amio
中级用户
  
积分 206
发帖 93
注册 2007-8-16
状态 离线
|
『楼 主』:
新的删除空格问题??
使用 LLM 解释/回答一下
----------------------
aaa bbb
[abcd]
aaa bbb
cc dd
-------------------------
处理后变为
-----------------------
aaa bbb
[abcd]
aaa bbb
cc dd
---------------------
字符中间空格不要删除,并且让带有 [] 的 上面空一行
----------------------
aaa bbb
aaa bbb
cc dd
---------------------
|
|
2008-5-29 20:00 |
|
|
bat-zw
金牌会员
      永远的学习者
积分 3105
发帖 1276
注册 2008-3-8
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set str=%%i
if "!str!" equ "" (
echo.&echo !str!
) else (
echo !str!
)
)
pause>nul
```
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set str=%%i
if "!str!" equ "" (
echo.&echo !str!
) else (
echo !str!
)
)
pause>nul
```
|

批处理之家新域名:www.bathome.net |
|
2008-5-29 20:17 |
|
|
amio
中级用户
  
积分 206
发帖 93
注册 2007-8-16
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
Originally posted by zw19750516 at 2008-5-29 08:17 PM:
@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set str=%%i
if "!str!" equ "" (
echo.&echo !str ...
能不能把 "" 换成 万能的 因为 还有 之类的
获取 "
Can the "" be replaced with something universal? Because there are also , , etc. How to obtain "
|
|
2008-5-29 20:26 |
|
|
WANKOILZ
初级用户
 
积分 198
发帖 89
注册 2007-9-6 来自 重庆
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
我发现一个更简洁的: @echo off
for /f "delims=" %%i in (1.txt) do (
if %%i== echo.
echo %%i
)
pause>nul
I found a more concise one:
@echo off
for /f "delims=" %%i in (1.txt) do (
if %%i== echo.
echo %%i
)
pause>nul
|
|
2008-5-29 20:27 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
@echo off
for /f "delims=" %%a in (a.txt) do (
if "%%a"=="" echo.
echo %%a
)
pause
```
@echo off
for /f "delims=" %%a in (a.txt) do (
if "%%a"=="" echo.
echo %%a
)
pause
```
|

致精致简! |
|
2008-5-29 20:30 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
晕,发帖后发现我以是5楼了,还以为是在3楼呢?
和4楼的一模一样。哈哈。。。
Oh, after posting, I found out I'm on the 5th floor. I thought I was on the 3rd floor? It's exactly the same as the 4th floor. Haha...
|

致精致简! |
|
2008-5-29 20:32 |
|
|
WANKOILZ
初级用户
 
积分 198
发帖 89
注册 2007-9-6 来自 重庆
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
我的还少了四个引号,呵呵........
I'm still missing four quotation marks, heh heh........
|
|
2008-5-29 20:41 |
|
|
amio
中级用户
  
积分 206
发帖 93
注册 2007-8-16
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
[abcd] 这个不光是一个啊 还有 [efgh] [ijk] 之类的
如果要有几十个 [] 一个个 添加太麻烦啊
This is not just one, there are also , and so on. If there are dozens of s, it's too cumbersome to add them one by one.
|
|
2008-5-29 20:47 |
|
|
WANKOILZ
初级用户
 
积分 198
发帖 89
注册 2007-9-6 来自 重庆
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
楼上说的这种情况还要具体情况具体分析才行。
The situation mentioned by the person upstairs still needs to be analyzed on a case-by-case basis.
|
|
2008-5-29 20:51 |
|
|
amio
中级用户
  
积分 206
发帖 93
注册 2007-8-16
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
不能就以 [ 做判断吗 如果有[ 就在上面空一行
Can't we just make a judgment based on
|
|
2008-5-29 21:16 |
|
|
WANKOILZ
初级用户
 
积分 198
发帖 89
注册 2007-9-6 来自 重庆
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
如果行的第一个字符就是@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set "str=%%i"
if "!str:~0,1!"=="
Last edited by WANKOILZ on 2008-5-29 at 09:22 PM ]
If the first character of the line is ' @echo off&setlocal enabledelayedexpansion
for /f "delims=" %%i in (1.txt) do (
set "str=%%i"
if "!str:~0,1!"=="
Last edited by WANKOILZ on 2008-5-29 at 09:22 PM ]
此帖被 +2 点积分 点击查看详情 评分人:【 amio 】 | 分数: +2 | 时间:2008-5-29 21:37 |
|
|
|
2008-5-29 21:20 |
|
|
zqz0012005
中级用户
  
积分 297
发帖 135
注册 2006-10-21
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
@echo off
for /f "delims=" %%i in (1.txt) do (
echo %%i|findstr "^$">nul&&echo.
echo %%i
)
pause>nul
```@echo off
for /f "delims=" %%i in (1.txt) do (
echo %%i|findstr "^$">nul&&echo.
echo %%i
)
pause>nul
|

hh.exe ntcmds.chm::/ntcmds.htm
 |
|
2008-5-29 21:24 |
|
|
26933062
银牌会员
    
积分 2268
发帖 879
注册 2006-12-19
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by zqz0012005 at 2008-5-29 21:24:
@echo off
for /f "delims=" %%i in (1.txt) do (
echo %%i|findstr "^$">nul&&echo.
echo %%i
)
pause>nul
呵呵,楼上的就真的存在效率问题了。
Originally posted by zqz0012005 at 2008-5-29 21:24:
@echo off
for /f "delims=" %%i in (1.txt) do (
echo %%i|findstr "^$">nul&&echo.
echo %%i
)
pause>nul
Hehe, the one upstairs really has an efficiency problem.
|

致精致简! |
|
2008-5-29 21:35 |
|
|
amio
中级用户
  
积分 206
发帖 93
注册 2007-8-16
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
Originally posted by 26933062 at 2008-5-29 09:35 PM:
呵呵,楼上的就真的存在效率问题了。
那个我试 根本就不好使 。
Originally posted by 26933062 at 2008-5-29 09:35 PM:
Hehe, the one upstairs really has an efficiency issue.
That one I tried doesn't work at all.
|
|
2008-5-29 21:39 |
|
|
amio
中级用户
  
积分 206
发帖 93
注册 2007-8-16
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
还有个问题
如果每行 前面有空格 也删除 ?
aaaaaaa
bbbbbbbbb
-----------------
aaaaaaa
bbbbbbbbb
There is another question. If there are spaces in front of each line, also delete them?
aaaaaaa
bbbbbbbbb
-----------------
aaaaaaa
bbbbbbbbb
|
|
2008-5-29 21:49 |
|