<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="index" title="Text File" newcontext="true">
<p>
#!/usr/local/bin/perl
</p>
<p>if ($#ARGV != 0) {
	print &quot;Usage: $0 &lt;directory name&gt;\n&quot;;
	exit;
}
</p>
<p>chdir @ARGV[0];
</p>
<p>open(tmphead, &quot;+&gt;/tmp/headers$$&quot;);
</p>
<p>$HeaderFlag = 1;
</p>
<p>while (&lt;STDIN&gt;) {
    #
    # Get rid of Headers we don&#x27;t want
    #
    if ((/^Received:/)||
	(/^Message-Id:/)||
	(/^Cc:/)) {
	next;
    }
</p>
<p>    if (/^Subject:/) {
	$SubjectLine = $_;
	$SubjectLine =~ s/^Subject: //;
    }
</p>
<p>    if ((/^$/) &amp;&amp; ($HeaderFlag == 1)) {
	# End of headers
</p>
<p>	open(Outfile, &quot;&gt;$SubjectLine&quot;);
	$HeaderFlag = 0;
</p>
<p>	seek(tmphead, 0,0);
	while (&lt;tmphead&gt;) {
	    if ((/^Date:/)     || (/^From:/) ||
		(/^Subject:/)  || (/^Keywords:/)||
		(/^Location:/) || (/^ACategory/)) {
</p>
<p>		print Outfile;
	    }
	}
	close(tmphead);
	unlink &quot;/tmp/headers$$&quot;;
    }
</p>
<p>    # Filter out the header lines
</p>
<p>    if ($HeaderFlag == 1) {
	print tmphead;
    }
    else {
	print Outfile;
    }
</p>
<p>}
</p>
<p></p>
<p>close Outfile;
</p>
</card>
</wml>
