Quick question, just wondering...

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
renzlo
Posts: 116
Joined: 03 May 2011 19:06

Quick question, just wondering...

#1 Post by renzlo » 13 Aug 2011 11:36

Hi All,

How do you escape double quotes (") in using findstr?

Example:

source.txt

Code: Select all

"Paul","Mike"


Search string is equal to:

Code: Select all

","[a-z]


findstr /ric:"","[a-z]" source.txt - this doesn't work
findstr /ric:"^",^"[a-z]" source.txt - doesn't work too

what else?

Thanks in advance.

taripo
Posts: 228
Joined: 01 Aug 2011 13:48

Re: Quick question, just wondering...

#2 Post by taripo » 13 Aug 2011 18:08

findstr /? says
\x Escape: literal use of metacharacter x

Also, I guess /r and /c are things you wouldn't use together
and that you'd want /r 'cos regex.


C:\abc>findstr /ri ","[a-z] source.txt

C:\abc>findstr /ri ^",^"[a-z] source.txt

C:\abc>findstr /ri \",\"[a-z] source.txt <-- that's it!
"Paul","Mike"
C:\abc>

renzlo
Posts: 116
Joined: 03 May 2011 19:06

Re: Quick question, just wondering...

#3 Post by renzlo » 13 Aug 2011 19:51

thanks for the reply taripo.

Post Reply