Need a good Unix script that..

Konrad Heuer kheuer2 at gwdg.de
Wed Mar 14 11:46:33 UTC 2007


On Wed, 14 Mar 2007, Christian Walther wrote:

> On 14/03/07, bstitt at tsys.com <bstitt at tsys.com> wrote:
>> 
>> 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.
>> 
> You can use something like:
>
> cat yourfile | grep -v pattern >newfile
>
> If there are several patterns to be removed, use something like:
>
> cat yourfile | egrep -v "(pattern1|pattern2|pattern3|...)" >newfile

The unofficial UNIX guru law says: Using cat with one and only one 
argument is prohibited! Just a joke, but typing

grep -v pattern <yourfile >newfile

saves system resources, doesn't it?

Best regards

Konrad Heuer
GWDG, Am Fassberg, 37077 Goettingen, Germany, kheuer2 at gwdg.de



More information about the freebsd-questions mailing list