Question regarding grep 2,6,3 regular expression looking for lines without something in a part of a line

Eric Blake eblake@redhat.com
Wed Oct 8 14:24:00 GMT 2014


On 10/08/2014 08:00 AM, Larry W. Virden wrote:
> I am using an older version of cygwin on a Windows 7 PC.
> I have a file of data that is formatted in character separated value format.
> For example, a couple of lines might be:
> 
> "Doe, John";"Student";"Senior"
> "Admin";"Staff";
> 
> Now, I want to perform a grep that returns lines that do not have a
> comma in the "first column" of data.
> 
> I tried the obvious
> grep '^"[^,"]";' file.csv

That looks for lines containing a literal quote, then exactly one quoted
character that is neither comma nor quote, then another literal quote.
You forgot the *:

'^"[^,"]*";'

Your question is not cygwin-specific.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20141008/3f902691/attachment.sig>


More information about the Cygwin mailing list