From owner-freebsd-questions@FreeBSD.ORG Wed Sep 29 14:15:13 2010 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 3E8F61065673 for ; Wed, 29 Sep 2010 14:15:13 +0000 (UTC) (envelope-from lhmwzy@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 11BF98FC0A for ; Wed, 29 Sep 2010 14:15:12 +0000 (UTC) Received: by pvc21 with SMTP id 21so226389pvc.13 for ; Wed, 29 Sep 2010 07:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hyXXTzY3c7MKIPsLlPicSWDmrBM8DEWf2DVyz6ij+4A=; b=mlTLYZfsHiv7yNYDzLzuEQ8PFD8e4J/Um9rp/8o/s8YaTyPIfPeS+lrLP98KglwqvY dblYODoulex/Akcb2nQJQkKEheJwMTi6J5HQ/AYyogOrhmAimbt+1PeubuoNPXLFgbCA dC08hnOUJr/BRLzTqt4g362iidR9wIOJsHTxI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=wgzb2Z+BJzRdzywu0KYCjuzRnSv7Z/X6f+VBI/0QOdZS+zf/cmURHVjunSxGNFuILI WfBiOCuqacSSe0In3fFFPS2FprZpNrqqGE1gDpJH194umYf95gCTT+0NzfwVQQp+y6Sp xcr7A41CSMzUXEwB/z3gx0siGQKrlSC8g/WKE= MIME-Version: 1.0 Received: by 10.142.54.13 with SMTP id c13mr1395786wfa.306.1285769711758; Wed, 29 Sep 2010 07:15:11 -0700 (PDT) Received: by 10.220.102.135 with HTTP; Wed, 29 Sep 2010 07:15:11 -0700 (PDT) In-Reply-To: <1285766018.90337.1198.camel@predator-ii.buffyverse> References: <1285766018.90337.1198.camel@predator-ii.buffyverse> Date: Wed, 29 Sep 2010 22:15:11 +0800 Message-ID: From: lhmwzy To: Wayne Sierke Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-questions@freebsd.org Subject: Re: sed problem 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, 29 Sep 2010 14:15:13 -0000 Both are working. Thk very much. 2010/9/29 Wayne Sierke : > On Wed, 2010-09-29 at 17:43 +0800, lhmwzy wrote: >> #%sed -e '/GROUP/{/Test/! d}' test >> sed: 1: "/GROUP/{/Test/! d} >> ": extra characters at the end of d command >> also have error. >> the system: >> #uname -a >> FreeBSD bxzxfreebsd.slof.com 7.2-RELEASE-p5 FreeBSD 7.2-RELEASE-p5 #1: >> Fri Dec =A04 17:58:13 CST 2009 >> lhm@bxzxfreebsd.slof.com:/usr/obj/usr/src/sys/lhmwzy =A0amd64 >> >> 2010/9/29 lhmwzy : >> > I have a txt file named test: >> > >> > USER Added by ftpadmin >> > GENERAL 0,0 120 204800 0 >> > LOGINS 1 0 -1 -1 >> > TIMEFRAME 0 0 >> > FLAGS 3 >> > TAGLINE lanshu4385 >> > DIR / >> > ADDED 1284812614 ftpadmin >> > EXPIRES 0 >> > CREDITS 15000 >> > RATIO 0 >> > ALLUP 0 0 0 >> > ALLDN 0 0 0 >> > WKUP 0 0 0 >> > WKDN 0 0 0 >> > DAYUP 0 0 0 >> > DAYDN 0 0 0 >> > MONTHUP 0 0 0 >> > MONTHDN 0 0 0 >> > NUKE 0 0 0 >> > TIME 0 1284812614 0 0 >> > GROUP Teest 0 >> > GROUP eest 0 >> > GROUP dTeest 0 >> > GROUP tTeest 0 >> > GROUP Test 0 >> > IP *@* >> > >> > when I use the follow command: >> > >> > #sed -e '/GROUP/{/Test/}! d' test >> > then output error: >> > >> > sed: 1: "/GROUP/{/Test/}! d >> > ": command } expects up to 0 address(es), found 1 >> > >> > But this command under linux is OK,how can I do? >> > > > Try: > > =A0 =A0 =A0 =A0sed -e '/GROUP/{/Test/!d;}' > > or: > > =A0 =A0 =A0 =A0sed -e '/GROUP/{' -e '/Test/!d' -e '}' > > > Wayne > > >