MS Dos Batch for deleting lines between words

August 23, 2011 at 12:31:55
Specs: Windows XP
Hi there,

I wonder if anyone know if it's possible to do a Window XP MS DOS batch file to delete lines in a txt file if the following condition applies.

INPUT FILE:

do something
do something

if( cond)
{
dbgprint(a,b, c);
}

do something
do something

#ifdef DEBUG_EN

do something
do something
#endef

do something
do something

#if DEBUG_EN
do something
#endef

do something

if( cond)
{
dbgprint(a,
b,
c);
}


do something

#if 1

#ifdef DEBUG_EN
do something
do something
#endef
#endef

do something

OUTPUT FILE:

do something
do something

if( cond)
{
}

do something
do something

do something
do something

do something

if( cond)
{
}


do something

#if 1

#endef

do something

------------------

Basically I want to remove all the lines that begins with dbgprint up to the last parentheses, all lines between #if DEBUG_EN as well as the closing #endef, all lines between #if DEBUG_EN and closing #endef.

They can be nested as in the sample above.


See More: MS Dos Batch for deleting lines between words

Report •


#1
August 23, 2011 at 13:48:05
a Window XP MS DOS batch file


That is a conflicting statement. It can be either Windows XP or MS-DOS but it cannot be both.

What you really mean is a batch file that runs from the Windows command prompt, a command prompt that happens to look like MS-DOS and there the similarity ends. MS-DOS was obsolete when Windows 2000 was released.

Stuart


Report •
Related Solutions


Ask Question