<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Assuming the header has "Gender" for the column title,<br>
<br>
egrep 'Gender|,M,' source.csv > males.csv<br>
egrep 'Gender|,F,' source.csv > females.csv<br>
<br>
Change the title and the criteria for the gender to match your file
(like ",M$" if at the end, etc). To make it case insensitive, use
"egrep -i".<br>
<br>
Going back to earlier conversation about shell tests, this could
also depend on what you are running it on. The grep on linux allows<br>
<br>
grep -E instead of egrep. It also has grep -P to allow PCRE.<br>
<br>
-spp<br>
<br>
<div class="moz-cite-prefix">On 10/6/2015 8:35 PM, Rick Hornsby
wrote:<br>
</div>
<blockquote
cite="mid:78A84BF7-3109-480D-821B-496CD1E1D279@gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Oct 6, 2015, at 18:57, Keith Larson <<a
moz-do-not-send="true" href="mailto:klarson@k12group.net"
class=""><a class="moz-txt-link-abbreviated" href="mailto:klarson@k12group.net">klarson@k12group.net</a></a>> wrote:</div>
<div class="">
<div style="font: 10pt/normal Segoe UI; font-size-adjust:
none; font-stretch: normal;" class="">
<div class="GroupWiseMessageBody"
id="GroupWiseSection_1444175483000_klarson@k12group.net_59511A0513870000BD1BF681F57056B0_">
<div class=""><br class="">
</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite" class="">
<div class="">
<div style="font: 10pt/normal Segoe UI; font-size-adjust:
none; font-stretch: normal;" class="">
<div class="GroupWiseMessageBody"
id="GroupWiseSection_1444175483000_klarson@k12group.net_59511A0513870000BD1BF681F57056B0_">
<div class="">I would like the header row in both files
if possible. </div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>To copy the header line, start thusly:</div>
<div>head -1 source.csv > males.csv</div>
<div>head -1 source.csv > females.csv</div>
<div><br class="">
</div>
<div>and every operation following that writes to the files, use
the >> append operator.</div>
<div><br class="">
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
colug-432 mailing list
<a class="moz-txt-link-abbreviated" href="mailto:colug-432@colug.net">colug-432@colug.net</a>
<a class="moz-txt-link-freetext" href="http://lists.colug.net/mailman/listinfo/colug-432">http://lists.colug.net/mailman/listinfo/colug-432</a>
</pre>
</blockquote>
<br>
</body>
</html>