Remove lines from txt file using script

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Tormod
Posts: 2
Joined: 09 Jun 2010 13:20

Remove lines from txt file using script

#1 Post by Tormod » 09 Jun 2010 14:22

Hi folks,

I've got several config files which I'm looking to archive using an automated tool which compares it to the most recent revision and archives if there are changes. However, several of the files have a line in them which contains a date and therefore the tool will always archive them.

I'm trying to write a script which will remove an entire line if it begins with a specific series of characters but to be honest I'm nowhere with this. I did try to search the forum for similar posts but couldn't see anything. I'm just really looking for someone to point me in the right direction not to do the thing for me.

Any help would be much appreciated.

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Remove lines from txt file using script

#2 Post by !k » 09 Jun 2010 14:59

findstr /?

Tormod
Posts: 2
Joined: 09 Jun 2010 13:20

Re: Remove lines from txt file using script

#3 Post by Tormod » 10 Jun 2010 01:37

Thanks very much. Managed it using

findstr /v/c:"search term" input.txt > "C:\output.txt"

Post Reply