From owner-freebsd-questions@freebsd.org Fri Mar 4 16:27:20 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 7642A9DA02F for ; Fri, 4 Mar 2016 16:27:20 +0000 (UTC) (envelope-from david+dated+1457540836.4504fc@skytracker.ca) 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 5FE8B391 for ; Fri, 4 Mar 2016 16:27:20 +0000 (UTC) (envelope-from david+dated+1457540836.4504fc@skytracker.ca) Received: by mailman.ysv.freebsd.org (Postfix) id 5AD759DA02E; Fri, 4 Mar 2016 16:27:20 +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 40A1E9DA02D for ; Fri, 4 Mar 2016 16:27:20 +0000 (UTC) (envelope-from david+dated+1457540836.4504fc@skytracker.ca) Received: from 3s1.com (3s1.com [162.213.106.199]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "3s1.com", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id EDD68390 for ; Fri, 4 Mar 2016 16:27:19 +0000 (UTC) (envelope-from david+dated+1457540836.4504fc@skytracker.ca) Received: from 3s1.com (localhost [127.0.0.1]) by 3s1.com (8.14.9/8.14.9) with ESMTP id u24GRGmw027967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 4 Mar 2016 11:27:17 -0500 (EST) (envelope-from david+dated+1457540836.4504fc@skytracker.ca) Received: (from david@localhost) by 3s1.com (8.14.9/8.14.9/Submit) id u24GRGdf027966 for questions@freebsd.org; Fri, 4 Mar 2016 11:27:16 -0500 (EST) (envelope-from david+dated+1457540836.4504fc@skytracker.ca) X-Authentication-Warning: 3s1.com: david set sender to david+dated+1457540836.4504fc@skytracker.ca using -f Received: by 3s1.com (tmda-sendmail, from uid 1000); Fri, 04 Mar 2016 11:27:14 -0500 Date: Fri, 4 Mar 2016 11:27:14 -0500 To: Guy TABRAR Cc: questions@freebsd.org Subject: Re: sed help please Message-ID: <20160304162713.GB27930@skytracker.ca> References: <20160304040536.GA7729@skytracker.ca> <2112385FC012E541A52D6A28563A5572A03A54@LONS00110044.mercury.intra> <20160304150250.GB24579@skytracker.ca> <2112385FC012E541A52D6A28563A5572A06B0C@LONS00110044.mercury.intra> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2112385FC012E541A52D6A28563A5572A06B0C@LONS00110044.mercury.intra> User-Agent: Mutt/1.4.2.3i X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: David Banning 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 16:27:20 -0000 > > echo '.....","The.....' | awk -F '()' '{print $1 $3}' Wow. Looks like that does it. Thanks Guy! > > > $2 between your two tags is the text you want to remove. > > Cheers > > Guy > > > -----Original Message----- > From: David Banning [mailto:david@skytracker.ca] > Sent: 04 March 2016 15:03 > To: Guy TABRAR > Subject: Re: sed help please > Importance: High > > On Fri, Mar 04, 2016 at 08:27:59AM +0000, Guy TABRAR wrote: > > # echo -e "line1\nline2\nfoo\nline4\nline5\nbar\nline7" | sed -n '/foo/,/bar/p' > > foo > > line4 > > line5 > > bar > > > > Thanks for your help Guy. > > I'm sorry but I mis-stated my original request. > > What I said was; > > I need a sed command that would take everything between foo and bar - including foo and bar. > > What I meant was; > I need a sed command that would delete all text and characters between foo and bar - including foo and bar. > > > > > > Regards > > > > Guy > > > > -----Original Message----- > > From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd-questions@freebsd.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 - including 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 only see the -s "", regarding backup file. > > > > Any pointers would be helpful. > > > need a sed command that would take everything between foo and bar - including foo and bar.> > > _______________________________________________ > > freebsd-questions@freebsd.org mailing list https://lists.freebsd.org/mailman/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) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited. > > > > Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additional disclosures. > > > > > > ___________________________________________________________ > 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) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited. > > Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additional disclosures. > >