[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Thu, 22 Dec 2005 16:45:37 -0500 -->
- <!--x-from-r13: tert.serrzlre ng tznvy.pbz (Uert Terrzlre) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] FGrep matches and non matches to two seperate files -->
- <li><em>date</em>: Thu, 22 Dec 2005 16:45:37 -0500</li>
- <li><em>from</em>: greg.freemyer at gmail.com (Greg Freemyer)</li>
- <li><em>in-reply-to</em>: <<a href="msg00321.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg00320.html">[email protected]</a>> <<a href="msg00321.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] FGrep matches and non matches to two seperate files</li>
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
> <a rel="nofollow" href="http://www.aismedia.com">http://www.aismedia.com</a> / jchum at aismedia.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> -----Original Message-----
> From: ale-bounces at ale.org [<a rel="nofollow" href="mailto:ale-bounces">mailto:ale-bounces</a> at ale.org] On Behalf Of Greg
> Freemyer
> Sent: Thursday, December 22, 2005 2:16 PM
> To: Atlanta Linux Enthusiasts
> Subject: Re: [ale] FGrep matches and non matches to two seperate files
>
> Are you just asking about "fgrep -v" ?
>
> On 12/22/05, Jonathan Chum <jchum at aismedia.com> wrote:
> >
> >
> >
> > I have a list of PostFix IDs in a file that I'm able to fgrep the initial
> > maillog and return all entries matching the IDs in the list. I'd like to
> > create two files with it though, one that contains the new maillog that
> > matches the IDs listed in the file and another file that contains the old
> > maillog without these lines.
> >
> >
> >
> > Any idea how I would go about accomplishing this? Thanks.
> >
> >
> >
> > 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
> > <a rel="nofollow" href="http://www.aismedia.com">http://www.aismedia.com</a> / jchum at aismedia.com
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> >
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > <a rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
> >
> >
>
>
> --
> Greg Freemyer
> The Norcross Group
> Forensics for the 21st Century
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> <a rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> <a rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale">http://www.ale.org/mailman/listinfo/ale</a>
>
--
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 & 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>