This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]