Need a good Unix script that..

alex at schnarff.com alex at schnarff.com
Wed Mar 14 11:35:13 UTC 2007


Why not use Perl? It'd be as simple as:

#!/usr/bin/perl

use strict;

open(IN, "$ARGV[0]") || die "Can't open $ARGV[0]: $!\n";
while (<IN>) {
     print $_ unless ($_ =~ /<regular expression describing lines you 
don't want>/);
}
close IN;

Save this script as "filter.pl" (or whatever you want to call it), and 
then just run "perl filter.pl <original file> > <filtered file>", which 
will pipe out all the lines you do want to <filtered file>.

Alex Kirk

> Hello,
>
> I'm trying to write a script to delete all line that include a certain
> pattern in an output file. I sending information to one of our Security
> people and they take this data and create a spreadsheet on the
> information, I have a constant reoccurring lines within the output file
> that they do not need. I'm trying to use the sed command to remove lines
> that fits a certain pattern but it does not appear to remove anything.
>
> Any helpful ideas or any useful links to scripts.
>
> Thanks so much..
>
> Bruce Stitt
> TSYS Hosting Services
> Voice 706-644-0965
>
> -----------------------------------------
> The information contained in this communication (including any
> attachments hereto) is confidential and is intended solely for the
> personal and confidential use of the individual or entity to whom
> it is addressed. The information may also constitute a legally
> privileged confidential communication. If the reader of this
> message is not the intended recipient or an agent responsible for
> delivering it to the intended recipient, you are hereby notified
> that you have received this communication in error and that any
> review, dissemination, copying, or unauthorized use of this
> information, or the taking of any action in reliance on the
> contents of this information is strictly prohibited. If you have
> received this communication in error, please notify us immediately
> by e-mail, and delete the original message. Thank you
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>




More information about the freebsd-questions mailing list