Remove Lines of text

June 9, 2009 at 19:32:04
Specs: Windows Vista
Hi,

I have a sample file

First line 11111 anything
second line anything
third line anything
fourth line 2222 anything
fifth line anything
sixth line anything
seventh line 3333 anything
eightth line anything
ninth line 1111 anything
tenth line anything
eleventh line anything
twelfth line 3333 anything
thirtienth line anything
fourteenth line anything

output wanted
First line 11111 anything
second line anything
third line anything
eleventh line anything
fourth line 2222 anything
fifth line anything
sixth line anything
seventh line 3333 anything
eightth line anything
fourteenth line anything

I need to remove lines based on ####, keeping first instance line with #### along with the lines directly below until I reach the next line with ####. However, subsequent instance(s) of same #### should only include lines that are NOT the line with #### and NOT the line directly below, but any other lines after the #### line and before the next line with ####.

This needs to work in different OS batch files


See More: Remove Lines of text

Report •


#1
June 9, 2009 at 20:15:57
i really couldn't get what you are saying. describe again, but this time don't use #### , use an actual number from your sample file. and don't write long winded english. Use examples of lines from your sample file to explain clearly.

Report •

#2
June 10, 2009 at 06:02:50
"This needs to work in different OS batch files"

Which ones?


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#3
June 10, 2009 at 09:48:28
I want to use this for both XP and Vista and on a Windows 2003 server.

I cannot give sample file for certain reasons, but here is part of it:

Input:

H,1,,220523,20090616,,,,
D,2,1,,,,,,,220523,PART,,,,
S,3,2,,,,,00012345,,,
SD,4,3,,,,,,,,,,,,,,,
H,1,,186284,20090616,,,,
D,2,1,,,,,,,186284,PART2,,,,
S,3,2,,,,,0006789,,,
SD,4,3,,,,,,,,,,,,,,,
H,1,,186677,20090616,,,,
D,2,1,,,,,,,186677,PART3,,,,
S,3,2,,,,,000121314,,,
SD,4,3,,,,,,,,,,,,,,,
H,1,,186284,20090616,,,,
D,2,1,,,,,,,186284,PART2,,,,
S,3,2,,,,,000678910,,,
SD,4,3,,,,,,,,,,,,,,,
H,1,,186677,20090616,,,,
D,2,1,,,,,,,186677,PART3,,,,
S,3,2,,,,,00012131415,,,
SD,4,3,,,,,,,,,,,,,,,

Hoping for Output:
H,1,,220523,20090616,,,,
D,2,1,,,,,,,220523,PART,,,,
S,3,2,,,,,00012345,,,
SD,4,3,,,,,,,,,,,,,,,
H,1,,186284,20090616,,,,
D,2,1,,,,,,,186284,PART2,,,,
S,3,2,,,,,0006789,,,
SD,4,3,,,,,,,,,,,,,,,
S,3,2,,,,,000678910,,,
SD,4,3,,,,,,,,,,,,,,,
H,1,,186677,20090616,,,,
D,2,1,,,,,,,186677,PART3,,,,
S,3,2,,,,,000121314,,,
SD,4,3,,,,,,,,,,,,,,,
S,3,2,,,,,00012131415,,,
SD,4,3,,,,,,,,,,,,,,,


Report •

Related Solutions


Ask Question