From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <50F0127C.1010204@yahoo.fr> Date: Fri, 11 Jan 2013 14:24:12 +0100 From: Nicolas Bercher User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> References: <50F00109.3070900@yahoo.fr> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [9fans] How to do this with [acme | sam | sed ] ? Topicbox-Message-UUID: 05f0a61e-ead8-11e9-9d60-3106f5b1d025 On 11/01/2013 14:10, Peter A. Cejchan wrote: >> echo 'abcd(x+(y-z))efgh' | sed 's;\(;;' | sed 's;(.*)\);\1;' > > Thanks, this is fine for my purpose (porting from C to Go), thanks! > Just removing parens around for and if statements on a single line. > > | 9 sed 's/\(//; s/(.*)\)/\1/' > (linux's sed does not work with it) Under Linux, you have to switch the syntax between escaped and literal parenthesis, this works fine: | 9 sed 's/(//; s/\(.*\))/\1/' Nicolas