From owner-freebsd-questions@freebsd.org Fri Mar 4 08:33:12 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35FE39DAC45 for ; Fri, 4 Mar 2016 08:33:12 +0000 (UTC) (envelope-from Guy.TABRAR@uk.bnpparibas.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 23EDDCB0 for ; Fri, 4 Mar 2016 08:33:12 +0000 (UTC) (envelope-from Guy.TABRAR@uk.bnpparibas.com) Received: by mailman.ysv.freebsd.org (Postfix) id 22CE89DAC44; Fri, 4 Mar 2016 08:33:12 +0000 (UTC) Delivered-To: questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2014F9DAC43 for ; Fri, 4 Mar 2016 08:33:12 +0000 (UTC) (envelope-from Guy.TABRAR@uk.bnpparibas.com) Received: from lonmail6.bnpparibas.com (lonmail6.bnpparibas.com [155.140.133.163]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "lonmail6.bnpparibas.com", Issuer "VeriSign Class 3 Secure Server CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 712DDCAF for ; Fri, 4 Mar 2016 08:33:11 +0000 (UTC) (envelope-from Guy.TABRAR@uk.bnpparibas.com) X-IronPort-AV: E=Sophos;i="5.22,535,1449532800"; d="scan'208";a="376704676" X-CheckPoint: {56D94710-4-E220070A-C0000008} From: Guy TABRAR To: David Banning , "questions@freebsd.org" Subject: RE: sed help please Thread-Topic: sed help please Thread-Index: AQHRdcyMn+H+sRygSkeotFgVDdbLCZ9I89PQ Date: Fri, 4 Mar 2016 08:27:59 +0000 Message-ID: <2112385FC012E541A52D6A28563A5572A03A54@LONS00110044.mercury.intra> References: <20160304040536.GA7729@skytracker.ca> In-Reply-To: <20160304040536.GA7729@skytracker.ca> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-GBS-PROC: pFNbfXZ3QfJn+oWo4NPYfDGcOxbl/KR2A7t1XcXVTxzsVkuCdmFuUeBtNp7QPzL+ Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2016 08:33:12 -0000 # echo -e "line1\nline2\nfoo\nline4\nline5\nbar\nline7" | sed -n '/foo/,/ba= r/p' foo line4 line5 bar Regards Guy = -----Original Message----- From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd-questions@f= reebsd.org] On Behalf Of David Banning Sent: 04 March 2016 04:06 To: questions@freebsd.org Subject: sed help please I am trying to change hundreds of lines of text. Given the following text; line 1 line 2 foo take this text line 3 line 4 line 5 bar leave this text line 6 line 7 = I need a sed command that would take everything between foo and bar - inclu= ding foo and bar. = Ideally the output would look like; line 1 line 2 leave this text line 6 line 7 Keep in mind that foo and bar appear in different locations - sometimes at = the beginning of a line, sometimes at the end, and sometimes in the middle.= I found someone who posted the following solution; sed '/foo/,/bar/{s/./x/g}' file but I found that this does not execute under FreeBSD. I have looked around= for differences between FreeBSD and other unix like SED operations but onl= y see the -s "", regarding backup file. Any pointers would be helpful. _______________________________________________ freebsd-questions@freebsd.org mailing list https://lists.freebsd.org/mailma= n/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" ___________________________________________________________ This e-mail may contain confidential and/or privileged information. If you = are not the intended recipient (or have received this e-mail in error) plea= se notify the sender immediately and delete this e-mail. Any unauthorised c= opying, disclosure or distribution of the material in this e-mail is prohib= ited. Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additi= onal disclosures.