[SGVLUG] Grep and the command line...

Emerson, Tom (*IC) Tom.Emerson at wbconsultant.com
Fri Jun 1 11:37:16 PDT 2007


First off, I'll admit I'm NOT a regex "guru", but I'm getting better.
Now I have a search that sorta has me stumped (and part of the problem
is that I'm doing this using the microsoft "SFU"(*) version of grep at
the DOS command line)

Here's the deal: I have a tab-delimited file that appears to have a
mismatched "quote" somewhere.  For example, the file /should/ look like
this:


-->key   <tab>description.....      <tab>123<tab>456<tab>etc.

Note that "description" is an essentially free-form text field.  Any
actual "tabs" in the data (description) have been converted to "<t>".
Somewhere in the file I have this:

-->key   <tab>"description....       <tab>123<tab>456<tab>etc.

Note the subtle inclusion of a double-quote character at the begninning
of the description, but not at the end.  This "quote" character is part
of the actual data.  As a result, the process importing the file sees
the initial quote character, strips it from the field, and looks for a
corresponding close-qoute.  Since it doesn't see it before the CR/LF, it
includes THE REST OF THE LINE as part of the description!

So, how do I search for the sequence <tab><double-quote>?

Bonus points for "how do I actually type this in at a command line"?
(using the aforementioned DOS command line and Microsoft's version of
grep?)

Tom

(*) SFU = Services for Unix -- a freebie from MS that includes a bash
shell, tab-completion [within DOS!] and a fairly standard assortment of
"basic tools"


More information about the SGVLUG mailing list