Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Russ Cox
> Is it really so? R. Cox (Regular Expression Matching Can Be Simple And > Fast), I think, shows, that repetition can be first expanded and then > used even by the nice (non-backtracking) algorithms, like this: > > e{3} --> eee > e{3,5} --> ?e? > e{3,} --> eee+ > > where would the problem arise

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread ron minnich
I still don't get the discussion. This is a research system. People want something. So implement that feature and see how it goes! Report when done :-) ron

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread John Stalker
> But I think that anyone not under the influence of psychedelic > substances that has suffered PCR, will agree we don't want to move in > that direction, and even if small, counting is a step in that > direction. Your feelings are understandable, given the horror of pcre, but in this case they ar

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Steve Simon
> Isn't it sad being in plan9?! Things should be simple, but not > simpler than that. I am not sad being in plan9 [sic]. I have used it as my main OS for about eight years and I have used sam exclusively for ten. During that time I cannot remember ever needing or wanting repeat counts on regular

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Rudolf Sykora
> i disagree with your premise that only vim has the vigor to > modify your super special file.  all you need is f and f*. > f transforms your source into something easy to edit in acme. > f* transforms it back into the original form.  easy peasy. > or, you can write a simple program that edits the

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread erik quanstrom
> The result of this discussion basically has been: neither acme nor sam > is suited for the original problem, there is no simple way present in > plan9 allowing you to edit such files with long lines, which are quite > commonly and with justification present in the world. Only Vim, which > was por

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Rudolf Sykora
> this is plan 9.  we don't ask if new feature > x would not cause a problem, we ask if x > would make plan 9 a better system. well, no-one disputes the claim, if you read twice. > i'm > quite sure one would be wrong in assuming > that plan 9's designers did not know about > repetition.  i think

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Rudolf Sykora
> "Sam and Acme use a simple, pure form of regular expressions. If they > had the counting operations, this would be a trivial task, but to add > them would open the door to the enormous, ill-conceived complexity of > (no longer) regular expressions as the open source community thinks of > them." >

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread erik quanstrom
> > Sam and Acme use a simple, pure form of regular expressions.  If they > > had the counting operations, this would be a trivial task, but to add > > them would open the door to the enormous, ill-conceived complexity of > > (no longer) regular expressions as the open source community thinks of >

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Uriel
>From earlier in this thread: "Sam and Acme use a simple, pure form of regular expressions. If they had the counting operations, this would be a trivial task, but to add them would open the door to the enormous, ill-conceived complexity of (no longer) regular expressions as the open source communi

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Rudolf Sykora
2009/3/4 Rob Pike : > Not all the features adapt as easily. > > -rob By counted repetittion I've always meant just the mentioned, i.e. {n} {n,} {,m} {n,m} . What feature do you have on mind? Thanks Ruda

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Rob Pike
Not all the features adapt as easily. -rob

Re: [9fans] command repetition in sam/acme

2009-03-04 Thread Rudolf Sykora
> Sam and Acme use a simple, pure form of regular expressions.  If they > had the counting operations, this would be a trivial task, but to add > them would open the door to the enormous, ill-conceived complexity of > (no longer) regular expressions as the open source community thinks of > them. I

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread J.R. Mauro
On Tue, Mar 3, 2009 at 9:15 PM, Rob Pike wrote: > .,.1000 > > and then snarf. > > It's a different model from the one you are familiar with.  That is > not a value judgment either way, but before pushing too hard in > comparisons or suggestions it helps to be familiar with both. I understand, I d

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Rob Pike
.,.1000 and then snarf. It's a different model from the one you are familiar with. That is not a value judgment either way, but before pushing too hard in comparisons or suggestions it helps to be familiar with both. -rob

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread J.R. Mauro
On Tue, Mar 3, 2009 at 7:56 PM, Rob Pike wrote: > Do you see utility in counting/movement commands if they are not > combined with regular expressions? > > If you want to make a substitution to the thousandth match of a > regular expression on a line, try > > s1000/[^ ]+/yyy/ > > But to na

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Rob Pike
Do you see utility in counting/movement commands if they are not combined with regular expressions? If you want to make a substitution to the thousandth match of a regular expression on a line, try s1000/[^ ]+/yyy/ But to navigate to that place is not as straightforward. Counting only

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread J.R. Mauro
On Tue, Mar 3, 2009 at 7:31 PM, Rob Pike wrote: > Sam and Acme use a simple, pure form of regular expressions.  If they > had the counting operations, this would be a trivial task, but to add > them would open the door to the enormous, ill-conceived complexity of > (no longer) regular expressions

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Rob Pike
Sam and Acme use a simple, pure form of regular expressions. If they had the counting operations, this would be a trivial task, but to add them would open the door to the enormous, ill-conceived complexity of (no longer) regular expressions as the open source community thinks of them. So yes: use

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Anthony Sorace
i agree complaining about the formats is pointless. and hey, at least it's text. last plain text format with slightly awkward lines i had to play with, they went and changed the next version to be ASN.1. but i don't think the suggestions here for how to make it play well with Acme are all that bad

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread J.R. Mauro
On Tue, Mar 3, 2009 at 5:13 PM, ron minnich wrote: > This discussion strikes me as coming from a different galaxy. It seems > to me that Acme and Sam clearly don't match the task at hand. We're > trying to use a screwdriver when we need a jackhammer . > > I don't see the point in complaining about

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread ron minnich
This discussion strikes me as coming from a different galaxy. It seems to me that Acme and Sam clearly don't match the task at hand. We're trying to use a screwdriver when we need a jackhammer . I don't see the point in complaining about file formats. The scientists in this case don't much care wh

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Arvindh Rajesh Tamilmani
> You can double-click at the beginning of the line and then execute > > s//\n/g > .-0+1000 > u > > that will show you what the 1000th word is it is useful to note down the address here. s//\n/g .-0+1000 =# u the output of '=#' can then be 'sent' to the sam window to reach the 1000th word. sett

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Rudolf Sykora
> Using a text editor to manipulate files with lines that are thousands > of words long seems like a not very good idea to me. 1st : I don't see why. I had a feeling there was some tendency (at least R Pike could have one) not to look at a file as on a list of lines, but as on a linear stream of b

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Uriel
Using a text editor to manipulate files with lines that are thousands of words long seems like a not very good idea to me. But all you need is two awk one liners to automate such task. Get desired word: awk -v w=1000 -v ORS=' ' -v 'RS= ' 'NR==w { print } ' Replace it with a new value: awk -v w=

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread roger peppe
2009/3/3 Russ Cox : > s//\n/g > .-0+1000 > u > > that will show you what the 1000th word is, and then you > can go back to it after the undo.  It's not ideal, but you asked. watch out though... that actually takes you to the 1001st word!

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Rudolf Sykora
> s//\n/g > .-0+1000 > u > Russ Either I don't understand or this can't help me much. It's true that I can see the 1000th word with this, but I need to edit that word then. Just seeing it is not enough. The very same word can be on the very line many times. Anyway the idea is quite the same as of

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Rudolf Sykora
Thanks for the suggestions. Basically you propose breaking the line into many lines, navigate using lines, edit, and then go back. That's possible and manageable. There is probably no need for having sth simple for this particular task, however, generally thinking about it, being able to repeat ei

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Russ Cox
> I just had to edit a file which has very long lines having >1000 > 'words' seperated e.g. with a TAB character. I had to find say 1000th > word on such a line. > > In vim, it's easy. You use '1000W' command and there you are. > Can the same be achieved in sam/acme? The main problem for me is the

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread yy
2009/3/3 roger peppe : > 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 i

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Uriel
Ok, I'm a moron for not reading the original post before answering. Never mind. uriel On Tue, Mar 3, 2009 at 4:58 PM, Uriel wrote: > awk '{n=n+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 i

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Uriel
awk '{n=n+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 Syko

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread roger peppe
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

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Rudolf Sykora
> It's horribly inelegant, but I have occasionally done the following: > Suppose I want to repeat the command xyz 64 times.  I type xyz, > snarf it and paste it three times.  Then I snarf the lot of them, > and paste three times.  Then I snarf that and paste three times. > Ugly as hell, but it does

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread John Stalker
> I just had to edit a file which has very long lines having >1000 > 'words' seperated e.g. with a TAB character. I had to find say 1000th > word on such a line. > > In vim, it's easy. You use '1000W' command and there you are. > Can the same be achieved in sam/acme? The main problem for me is the

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread 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. Ruda

Re: [9fans] command repetition in sam/acme

2009-03-03 Thread Steve Simon
I would do it with awk myself, Much depends on what you want to do to the 1000'th word on the line. in sam you can even play with your awk script in the command window, editing it submitting it and if its wrong you just Undo and try again. Similar things can be done in acme I believe but I don't

[9fans] command repetition in sam/acme

2009-03-03 Thread Rudolf Sykora
Hello, I just had to edit a file which has very long lines having >1000 'words' seperated e.g. with a TAB character. I had to find say 1000th word on such a line. In vim, it's easy. You use '1000W' command and there you are. Can the same be achieved in sam/acme? The main problem for me is the rep