From owner-freebsd-questions@FreeBSD.ORG Tue Jan 4 13:29:29 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AEAC1065672 for ; Tue, 4 Jan 2011 13:29:29 +0000 (UTC) (envelope-from patrick.bihan-faou@teambox.fr) Received: from smtp.teambox.fr (dedibox.teambox.fr [88.191.109.88]) by mx1.freebsd.org (Postfix) with ESMTP id D895E8FC08 for ; Tue, 4 Jan 2011 13:29:28 +0000 (UTC) Received: from crest.teambox.fr (crest.mindstep.com [88.167.204.204]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: teambox) by smtp.teambox.fr (Postfix) with ESMTPSA id C651FA2454A for ; Tue, 4 Jan 2011 14:12:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by kawa.local.mindstep.fr (Postfix) with ESMTP id 0F1BAFDBF7D for ; Tue, 4 Jan 2011 14:12:24 +0100 (CET) (envelope-from patrick.bihan-faou@teambox.fr) Received: from kawa.local.mindstep.fr ([127.0.0.1]) by localhost (kawa.local.mindstep.fr [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bmDtfxija4U2 for ; Tue, 4 Jan 2011 14:12:23 +0100 (CET) Received: from [127.0.0.1] (unknown [192.168.25.162]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by kawa.local.mindstep.fr (Postfix) with ESMTP id DD257FDB838 for ; Tue, 4 Jan 2011 14:12:23 +0100 (CET) (envelope-from patrick.bihan-faou@teambox.fr) Message-ID: <4D231CB7.2060902@teambox.fr> Date: Tue, 04 Jan 2011 14:12:23 +0100 From: Patrick Bihan-Faou Organization: TeamBox SARL User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <117654.42578.qm@web121409.mail.ne1.yahoo.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: a perl question 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: Tue, 04 Jan 2011 13:29:29 -0000 Le 04/01/2011 14:06, krad a écrit : > On 4 January 2011 10:32, S Mathias wrote: > >> cat asdf.txt >> bla-bla >> bla-bla >> bla[XYZ] >> importantthing >> another important thing >> [/XYZ] >> bla-bla >> bla-bla >> [XYZ] >> yet another thing >> hello! >> [/XYZ] >> bla-bla >> etc. >> $ SOMEPERLMAGIC asdf.txt> output.txt >> $ cat output.txt >> importantthing >> another important thing >> yet another thing >> hello! >> >> >> how can i sovle this question? what is SOMEPERLMAGIC? are there any perl >> gurus, that have a little spare time? >> >> Thank you! :\ >> >> >> >> _______________________________________________ >> freebsd-questions@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to " >> freebsd-questions-unsubscribe@freebsd.org" >> > > doesnt need to be perl either > > cat asdf.txt | awk 'BEGIN {a=0} { if ( $0 ~ /\[XYZ\]/ ) a=1; if ( $0 ~ > /\[\/XYZ\]/ ) a=0; if ( a == 1) print $0}' > > or something close to it Simpler yet cat asdf.txt | grep -v XYZ | grep -v bla Patrick.