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.
Is it
Not all the features adapt as easily.
-rob
2009/3/4 Rob Pike robp...@gmail.com:
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
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
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,
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 it
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 ported
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
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
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 are
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
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?
The
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
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
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
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
2009/3/3 Rudolf Sykora rudolf.syk...@gmail.com:
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
awk '{n=n+NF} n1000 {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 rogpe...@gmail.com wrote:
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 urie...@gmail.com wrote:
awk '{n=n+NF} n1000 {print :NR; exit}'
That will print something you can plumb and go to the line you want.
Should be obvious enough how to
2009/3/3 roger peppe rogpe...@gmail.com:
2009/3/3 Rudolf Sykora rudolf.syk...@gmail.com:
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
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
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
s/tab/\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
2009/3/3 Russ Cox r...@swtch.com:
s/tab/\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!
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
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
You can double-click at the beginning of the line and then execute
s/tab/\n/g
.-0+1000
u
that will show you what the 1000th word is
it is useful to note down the address here.
s/tab/\n/g
.-0+1000
=#
u
the output of '=#' can then be 'sent' to the
sam window to reach the 1000th word.
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
On Tue, Mar 3, 2009 at 5:13 PM, ron minnich rminn...@gmail.com 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
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
On Tue, Mar 3, 2009 at 7:31 PM, Rob Pike robp...@gmail.com 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)
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
On Tue, Mar 3, 2009 at 7:56 PM, Rob Pike robp...@gmail.com 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/
.,.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
On Tue, Mar 3, 2009 at 9:15 PM, Rob Pike robp...@gmail.com 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
35 matches
Mail list logo