From owner-freebsd-questions@FreeBSD.ORG Wed Mar 14 11:46:33 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 147E316A401 for ; Wed, 14 Mar 2007 11:46:33 +0000 (UTC) (envelope-from kheuer2@gwdg.de) Received: from gwdu60.gwdg.de (gwdu60.gwdg.de [134.76.8.60]) by mx1.freebsd.org (Postfix) with ESMTP id 9F38C13C4AE for ; Wed, 14 Mar 2007 11:46:32 +0000 (UTC) (envelope-from kheuer2@gwdg.de) Received: from gwdu60.gwdg.de (localhost [127.0.0.1]) by gwdu60.gwdg.de (8.13.6/8.13.6) with ESMTP id l2EBkVwb042975; Wed, 14 Mar 2007 12:46:31 +0100 (CET) (envelope-from kheuer2@gwdg.de) Received: from localhost (kheuer2@localhost) by gwdu60.gwdg.de (8.13.6/8.13.6/Submit) with ESMTP id l2EBkUaB042972; Wed, 14 Mar 2007 12:46:30 +0100 (CET) (envelope-from kheuer2@gwdg.de) X-Authentication-Warning: gwdu60.gwdg.de: kheuer2 owned process doing -bs Date: Wed, 14 Mar 2007 12:46:30 +0100 (CET) From: Konrad Heuer To: Christian Walther In-Reply-To: <14989d6e0703140433t6fcdcccei9dc60b26bffc35bd@mail.gmail.com> Message-ID: <20070314124231.Q1061@gwdu60.gwdg.de> References: <14989d6e0703140433t6fcdcccei9dc60b26bffc35bd@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "bstitt@tsys.com" , freebsd-questions@freebsd.org Subject: Re: Need a good Unix script that.. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2007 11:46:33 -0000 On Wed, 14 Mar 2007, Christian Walther wrote: > On 14/03/07, bstitt@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 newfile saves system resources, doesn't it? Best regards Konrad Heuer GWDG, Am Fassberg, 37077 Goettingen, Germany, kheuer2@gwdg.de