[colug-432] help with awk

Keith Larson klarson at k12group.net
Tue Oct 6 19:57:34 EDT 2015


I think that awk is the right tool, but I'm open to a better solution if there is one.

I have a .csv format file that I want to split into two files based on the value found in one of the columns.  For discussion purposes, say that the file has several different values about a person.  FirstName, LastName, Phone, DOB and Gender.  The file does have a header row.  I would like two files, one with all entries where gender is M and another file where gender is F.  I would like the header row in both files if possible.  The key is that I want the row to be kept completely intact with the delimiters remaining in place.

Any suggested solutions?  Ideally, I want something that can be done in a bash script so that I can run this on a nightly schedule.

Keith  Larson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20151006/4f3850b5/attachment.html 


More information about the colug-432 mailing list