Original Poster
Posted 2008-05-29 20:00 · 中国 辽宁 本溪 中移铁通
中级用户
★★
Credits 206 Posts 93 Joined 2007-08-16 17:19 18-year member UID 95263 Gender Male
Status Offline
----------------------
aaa bbb
[abcd]
aaa bbb
cc dd
---------------------
Floor 2
Posted 2008-05-29 20:17 · 中国 湖南 株洲 电信
金牌会员
★★★★
永远的学习者
Credits 3,105 Posts 1,276 Joined 2008-03-08 13:00 18-year member UID 112398 Gender Male
Status Offline
```
@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
Floor 3
Posted 2008-05-29 20:26 · 中国 辽宁 本溪 中移铁通
中级用户
★★
Credits 206 Posts 93 Joined 2007-08-16 17:19 18-year member UID 95263 Gender Male
Status Offline
Can the "" be replaced with something universal? Because there are also , , etc. How to obtain "
Floor 4
Posted 2008-05-29 20:27 · 中国 重庆 电信
初级用户
★★
Credits 198 Posts 89 Joined 2007-09-06 23:22 18-year member UID 96746 Gender Male From 重庆
Status Offline
I found a more concise one:
@echo off
for /f "delims=" %%i in (1.txt) do (
if %%i== echo.
echo %%i
)
pause>nul
Floor 5
Posted 2008-05-29 20:30 · 中国 湖南 娄底 电信
银牌会员
★★★
Credits 2,268 Posts 879 Joined 2006-12-19 16:23 19-year member UID 73968 Gender Male
Status Offline
```
@echo off
for /f "delims=" %%a in (a.txt) do (
if "%%a"=="" echo.
echo %%a
)
pause
```
致精致简!
Floor 6
Posted 2008-05-29 20:32 · 中国 湖南 娄底 电信
银牌会员
★★★
Credits 2,268 Posts 879 Joined 2006-12-19 16:23 19-year member UID 73968 Gender Male
Status Offline
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...
致精致简!
Floor 7
Posted 2008-05-29 20:41 · 中国 重庆 电信
初级用户
★★
Credits 198 Posts 89 Joined 2007-09-06 23:22 18-year member UID 96746 Gender Male From 重庆
Status Offline
I'm still missing four quotation marks, heh heh........
Floor 8
Posted 2008-05-29 20:47 · 中国 辽宁 本溪 中移铁通
中级用户
★★
Credits 206 Posts 93 Joined 2007-08-16 17:19 18-year member UID 95263 Gender Male
Status Offline
[abcd] This is not just one, there are also [efgh], [ijk] and so on. If there are dozens of []s, it's too cumbersome to add them one by one.
Floor 9
Posted 2008-05-29 20:51 · 中国 重庆 电信
初级用户
★★
Credits 198 Posts 89 Joined 2007-09-06 23:22 18-year member UID 96746 Gender Male From 重庆
Status Offline
The situation mentioned by the person upstairs still needs to be analyzed on a case-by-case basis.
Floor 10
Posted 2008-05-29 21:16 · 中国 辽宁 本溪 中移铁通
中级用户
★★
Credits 206 Posts 93 Joined 2007-08-16 17:19 18-year member UID 95263 Gender Male
Status Offline
Can't we just make a judgment based on [? If there is [, leave a blank line above it
Floor 11
Posted 2008-05-29 21:20 · 中国 重庆 电信
初级用户
★★
Credits 198 Posts 89 Joined 2007-09-06 23:22 18-year member UID 96746 Gender Male From 重庆
Status Offline
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 ]
Recent Ratings for This Post
( 1 in total)
Click for details
Rater Score Time
amio
+2
2008-05-29 21:37
Floor 12
Posted 2008-05-29 21:24 · 中国 四川 成都 电信
中级用户
★★
Credits 297 Posts 135 Joined 2006-10-21 12:00 19-year member UID 67627 Gender Male
Status Offline
```@echo off
for /f "delims=" %%i in (1.txt) do (
echo %%i|findstr "^$">nul&&echo.
echo %%i
)
pause>nul
Floor 13
Posted 2008-05-29 21:35 · 中国 湖南 娄底 电信
银牌会员
★★★
Credits 2,268 Posts 879 Joined 2006-12-19 16:23 19-year member UID 73968 Gender Male
Status Offline
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.
致精致简!
Floor 14
Posted 2008-05-29 21:39 · 中国 辽宁 本溪 中移铁通
中级用户
★★
Credits 206 Posts 93 Joined 2007-08-16 17:19 18-year member UID 95263 Gender Male
Status Offline
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.
Floor 15
Posted 2008-05-29 21:49 · 中国 辽宁 本溪 中移铁通
中级用户
★★
Credits 206 Posts 93 Joined 2007-08-16 17:19 18-year member UID 95263 Gender Male
Status Offline
There is another question. If there are spaces in front of each line, also delete them?
aaaaaaa
bbbbbbbbb
-----------------
aaaaaaa
bbbbbbbbb
Forum Jump:
— Select —
站务公告 & 版主讨论
意见反馈 & 网友交流
DOS学习入门 & 精彩文章 (教学室)
DOS疑难解答 & 问题讨论 (解答室)
DOS启动盘 & LOGO技术 (启动盘室)
DOS批处理 & 脚本技术(批处理室)
DOS媒体世界 & 网络技术 (多媒体室)
DOS汉化世界 & 中文系统 (中文化室)
DOS开发编程 & 发展交流 (开发室)
DOS软件下载 & 游戏分享 (下载室)
GRUB4DOS、SYSLINUX及其它启动管理软件讨论专区
其它操作系统综合讨论区
WinPE、PowerShell及其它命令行系统专区
贴图灌水、文学娱乐专区
网络日志(Blog)
论坛回收站
├ 链接失效,待修正