Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread Rudolf Sykora
On 11 January 2013 12:19, Peter A. Cejchan tyap...@gmail.com wrote: # remove outermost pair of braces: abcd(x+(y-z))efgh -- abcdx+(y-z)efgh This, I believe, can't be achieved only with regexps. I'd write a small external program and use it as a filter. # prefix to postfix operator: ++i --

Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread Bence Fábián
for the third: /\+\+[a-zA-Z_]+[0-9a-zA-Z_]*/{ x/\+\+/d a/++/ } the braces stuff is pretty tough, but maybe someone will have an idea. however it is really easy to do it by hand in acme. click on the inside of the opening paren with a double click then click button 2 (while still holding down

Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread Peter A. Cejchan
how it come i didn't realize that ;-) ! thanks, peter On Fri, Jan 11, 2013 at 12:46 PM, Bence Fábián beg...@gmail.com wrote: for the third: /\+\+[a-zA-Z_]+[0-9a-zA-Z_]*/{ x/\+\+/d a/++/ } the braces stuff is pretty tough, but maybe someone will have an idea. however it is really easy to

Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread Nicolas Bercher
On 11/01/2013 12:19, Peter A. Cejchan wrote: ## How to do this with [acme | sam | sed ] ? # compound commands # remove outermost pair of braces: abcd(x+(y-z))efgh -- abcdx+(y-z)efgh [ no idea :-( ] Is this enough? echo 'abcd(x+(y-z))efgh' | sed 's;\(;;' | sed 's;(.*)\);\1;'

Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread dexen deVries
On Friday 11 of January 2013 13:24:12 Peter A. Cejchan wrote: I am now on p9p and this does not work - at least with (... )* using the \1 (used to be undocumented on plan9) may be sometimes easier Edit s/\+\+([A-Za-z]+[A-Za-z0-9])*/\1++/ oughta be Edit s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/

Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread Nicolas Bercher
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

Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread erik quanstrom
# remove outermost pair of braces: abcd(x+(y-z))efgh -- abcdx+(y-z)efgh [ no idea :-( ] this is made simple since * is greedy: Edit s:\((.*)\):\1:g On Fri Jan 11 06:45:39 EST 2013, rudolf.syk...@gmail.com wrote: On 11 January 2013 12:19, Peter A. Cejchan tyap...@gmail.com wrote:

Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread Rudolf Sykora
On 11 January 2013 15:24, erik quanstrom quans...@quanstro.net wrote: # remove outermost pair of braces: abcd(x+(y-z))efgh -- abcdx+(y-z)efgh [ no idea :-( ] this is made simple since * is greedy: Edit s:\((.*)\):\1:g Sure, this (the greediness) basically already stands behind