Quicker method than findstr?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Quicker method than findstr?

#1 Post by SIMMS7400 » 17 May 2017 07:09

Hi Folks -

I have a file that's almost 7k rows.

I need ot remove all lines that begin with "PFP

So this is my code:

Code: Select all

findstr /v /i /b ""PFP" Input.csv > Output.csv


However it's taking forever. Anyway to speed this process up?

Thanks!

batnoob
Posts: 56
Joined: 19 Apr 2017 12:23

Re: Quicker method than findstr?

#2 Post by batnoob » 17 May 2017 13:31

SIMMS7400 wrote:

Code: Select all

findstr /v /i /b ""PFP" Input.csv > Output.csv


However it's taking forever. Anyway to speed this process up?

Thanks!


if that is exactly what your code says, then take off the extra quote

Code: Select all

findstr /v /i /b "PFP" Input.csv > Outpu.csv

SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Re: Quicker method than findstr?

#3 Post by SIMMS7400 » 17 May 2017 13:50

My strings are quoted in the file, hence why I need that.

"PFP is the string I"m searching for...

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Quicker method than findstr?

#4 Post by aGerman » 17 May 2017 13:54

As far as I remember you have to escape the quotation mark in a FINDSTR pattern.

Code: Select all

findstr /vib "\"PFP" Input.csv > Output.csv

Steffen

EDIT
Unbalanced quotes are always a mess. Could be you have to escape the last one using a caret.

Code: Select all

findstr /vib "\"PFP^" Input.csv > Output.csv

SIMMS7400
Posts: 546
Joined: 07 Jan 2016 07:47

Re: Quicker method than findstr?

#5 Post by SIMMS7400 » 18 May 2017 10:56

aGerman wrote:As far as I remember you have to escape the quotation mark in a FINDSTR pattern.

Code: Select all

findstr /vib "\"PFP" Input.csv > Output.csv

Steffen

EDIT
Unbalanced quotes are always a mess. Could be you have to escape the last one using a caret.

Code: Select all

findstr /vib "\"PFP^" Input.csv > Output.csv


Works like a charm! Thank you, S!

Post Reply