Computing.Net > Forums > Programming > Deleting lines with batch files

Deleting lines with batch files

Reply to Message Icon

Original Message
Name: Tizian
Date: September 14, 2005 at 07:54:01 Pacific
Subject: Deleting lines with batch files
OS: Windows XP: SP 2
CPU/Ram: 512
Comment:

I want to do a (preferably) batch file, that searches for a certain string in a file and deletes the line its at.

So if for example the file consists of:

multi square john 3323
single square johnp 3512
single square peter 5100
Single square jonna 2211

and the string to find was john, it would delete both lines involving something with john.

Thank you in advance
Philip Munksgaard


Report Offensive Message For Removal


Response Number 1
Name: Mechanix2Go
Date: September 14, 2005 at 08:12:07 Pacific
Subject: Deleting lines with batch files
Reply: (edit)

find /v "john" < oldfile > newfile


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

M2


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Deleting lines with batch files

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge