[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



I think the below script works.

===========
#!/bin/sh

> outfile1
> outfile2
awk '
/pattern/ { print >> "outfile1" }
!/pattern/ { print >> "outfile2" }
' inputfile
========

HTH
Greg

On 12/22/05, Jonathan Chum <jchum at aismedia.com> wrote:
> Sorta of, but that would require one additional process to run to invert the
> list.
>
> For example, I have 25 MB Postfix log file which I've wrote a script that
> extracts the IDs for a specific from <> address, then use fgrep to extract
> the logs specific to that domain.
>
> That process takes about 5 minutes to process 17,000 unique IDs.
>
> If I use the -v invert, then it's another 5 minutes to generate a new list.
> I figure that if fgrep scans a file line by line for a match, there would be
> a way to process those that didn't match into another file to save time from
> re-processing the script.
>
> If there's not a utility to do this, I could write the procedure in Perl
> that replicated what fgrep does, but I wanted to be sure that there isn't a
> utility out there already.
>
> Regards,
> Jonathan Chum
> Senior Developer
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> AIS Media, Inc. - "Passion. Innovation. Expertise"
> 7000 Central Parkway, Suite 1700
> Atlanta, GA 30328
> Tel: 770.350.7998 / Fax: 770.350.9409
&gt; <a  rel="nofollow" href="http://www.aismedia.com";>http://www.aismedia.com</a> / jchum at aismedia.com
&gt; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&gt;
&gt; -----Original Message-----
&gt; From: ale-bounces at ale.org [<a  rel="nofollow" href="mailto:ale-bounces";>mailto:ale-bounces</a> at ale.org] On Behalf Of Greg
&gt; Freemyer
&gt; Sent: Thursday, December 22, 2005 2:16 PM
&gt; To: Atlanta Linux Enthusiasts
&gt; Subject: Re: [ale] FGrep matches and non matches to two seperate files
&gt;
&gt; Are you just asking about &quot;fgrep -v&quot; ?
&gt;
&gt; On 12/22/05, Jonathan Chum &lt;jchum at aismedia.com&gt; wrote:
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; I have a list of PostFix IDs in a file that I'm able to fgrep the initial
&gt; &gt; maillog and return all entries matching the IDs in the list. I'd like to
&gt; &gt; create two files with it though, one that contains the new maillog that
&gt; &gt; matches the IDs listed in the file and another file that contains the old
&gt; &gt; maillog without these lines.
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Any idea how I would go about accomplishing this? Thanks.
&gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; Regards,
&gt; &gt;  Jonathan Chum
&gt; &gt;  Senior Developer
&gt; &gt;
&gt; &gt;
&gt; &gt;  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&gt; &gt;  AIS Media, Inc. - &quot;Passion. Innovation. Expertise&quot;
&gt; &gt;  7000 Central Parkway, Suite 1700
&gt; &gt;  Atlanta, GA 30328
&gt; &gt;  Tel: 770.350.7998 / Fax: 770.350.9409
&gt; &gt;  <a  rel="nofollow" href="http://www.aismedia.com";>http://www.aismedia.com</a> / jchum at aismedia.com
&gt; &gt;  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&gt; &gt;
&gt; &gt;
&gt; &gt; _______________________________________________
&gt; &gt; Ale mailing list
&gt; &gt; Ale at ale.org
&gt; &gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt; &gt;
&gt; &gt;
&gt;
&gt;
&gt; --
&gt; Greg Freemyer
&gt; The Norcross Group
&gt; Forensics for the 21st Century
&gt; _______________________________________________
&gt; Ale mailing list
&gt; Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt;
&gt; _______________________________________________
&gt; Ale mailing list
&gt; Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt;


--
Greg Freemyer
The Norcross Group
Forensics for the 21st Century


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00326" href="msg00326.html">[ale] FGrep matches and non matches to two seperate files</a></strong>
<ul><li><em>From:</em> esoteric at 3times25.net (Geoffrey)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00320" href="msg00320.html">[ale] FGrep matches and non matches to two seperate files</a></strong>
<ul><li><em>From:</em> greg.freemyer at gmail.com (Greg Freemyer)</li></ul></li>
<li><strong><a name="00321" href="msg00321.html">[ale] FGrep matches and non matches to two seperate files</a></strong>
<ul><li><em>From:</em> jchum at aismedia.com (Jonathan Chum)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00323.html">[ale] SuSE 10 &amp; Intel 536ep modem</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00324.html">[ale] OT: question about replacing batteries in a APC UPS</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00321.html">[ale] FGrep matches and non matches to two seperate files</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00326.html">[ale] FGrep matches and non matches to two seperate files</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00322"><strong>Date</strong></a></li>
<li><a href="threads.html#00322"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>