From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 3 Mar 2009 16:58:11 +0100 Message-ID: <5d375e920903030758w26137d7boa08fb1f8c2bda9bd@mail.gmail.com> From: Uriel To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] command repetition in sam/acme Topicbox-Message-UUID: ac825684-ead4-11e9-9d60-3106f5b1d025 awk '{n=3Dn+NF} n>1000 {print ":"NR; exit}' That will print something you can plumb and go to the line you want. Should be obvious enough how to generalize into a reusable script. (Typed from memory and not tested.) uriel On Tue, Mar 3, 2009 at 4:40 PM, roger peppe wrote: > 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/[ =C2=A0 =C2=A0 =C2=A0 ]+/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. > >