China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-09-28 16:36
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Use sed to delete blank lines made up of spaces View 2,171 Replies 18
Floor 16 Posted 2008-07-14 18:35 ·  中国 辽宁 营口 中移铁通
中级用户
★★
Credits 206
Posts 93
Joined 2007-08-16 17:19
19-year member
UID 95263
Gender Male
Status Offline
Won't make a new thread, let me ask one more question about sed.
Delete all lines under a line containing [] until the next [] line, including the [] lines themselves.

Example:

[aaa]
111
222
333

[bbb]
444
555
666

[ccc]
777
888
999

Becomes:

[aaa]
111
222
333

[ccc]
777
888
999

Better not judge by line numbers
Floor 17 Posted 2008-07-14 19:37 ·  中国 重庆 九龙坡区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Including the [] lines themselves—if you match by that condition, then shouldn't everything under [aaa] and [ccc] also be deleted?
Floor 18 Posted 2008-07-15 18:34 ·  中国 辽宁 营口 中移铁通
中级用户
★★
Credits 206
Posts 93
Joined 2007-08-16 17:19
19-year member
UID 95263
Gender Male
Status Offline
I mean [bbb] itself
Floor 19 Posted 2008-07-15 20:58 ·  中国 重庆 九龙坡区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Forum Jump: