From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sat, 21 Oct 2006 23:05:02 +0100 From: "Arvindh Rajesh Tamilmani" To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: [9fans] rectangle dot in acme Topicbox-Message-UUID: d030e27e-ead1-11e9-9d60-3106f5b1d025 The script below (called rect) partially implements kill-rectangle and string-rectangle commands from emacs. For example, select :/-a/,/-b/ in an acme window containing the following lines: /bin/bind -a '#L' /dev >/dev/null >[2=1] /bin/bind -a '#w1' /dev >/dev/null >[2=1] /bin/bind -a '#t' /dev >/dev/null >[2=1] /bin/bind -b '#A' /dev >/dev/null >[2=1] Now 2-1 chord on rect deletes the options to bind. 2-1 on "rect -b" replaces the options to bind with -b. This can be achieved using Edit but I found these shortcuts quite handy in emacs while extracting columns of data from log files. Comments welcome. Thanks. Arvindh P.S. The script doesn't work in an unnamed acme window - $acmeaddr is unset in that case. #!/bin/rc if(~ $acmeaddr '') exit 'nil acmeaddr' if(~ $#* 2) repl=$1 cd /mnt/acme/$winid p=`{echo $acmeaddr | sed 's/.*#(.*),#(.*)/\1 \2/'} p1=$p(1) p2=$p(2) q=`{sam -d body >[2=1] <addr sed $q(1)^,$q(3)^'s/(^'$"prere')(.*|('$"rowre'(.*)))/\1'$"repl'\4/' body >data