From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 3 Mar 2009 15:40:17 +0000 Message-ID: From: roger peppe To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [9fans] command repetition in sam/acme Topicbox-Message-UUID: ac66746e-ead4-11e9-9d60-3106f5b1d025 2009/3/3 Rudolf Sykora : >> I would do it with awk myself, Much depends on what you want to >> do to the 1000'th word on the line. > > Say I really want to get there, so that I can manually edit the place. if i really had to do this (as a one-off), i'd probably do it in a few stages: copy & paste the line to a New blank window. in the new window: Edit ,x/[ ]+/a/\n/ :1000 edit as desired Edit ,x/\n/d copy and paste back to the original window. if you were going to do this a lot, you could easily make a little script to tell you the offset of the 1000th word. e.g. sed 's/[ \t]+/&\n/' | sed 1000q | tr -d '\012' | wc -c actually that doesn't work 'cos sed has line length issues. so i'd probably do it in C - the program would take the line as stdin and could print out address of the word in acme-friendly notation, e.g. :-++#8499;+#6 it'd only be a few minutes to write. another option would be to write a little script that used the addr file repeatedly to find the nth match of a regexp.