My question is, how to
impliment non-parallel loop/condition commands in Sam?
As you noticed, it's a different model from ed, sed, etc.
In sam, you can specify sequential edits on separate lines,
and a collection of lines can be grouped into a single action
by surrounding the lines with braces
, | tail -r
is simpler.
-rob
On Thu, Feb 7, 2008 at 8:55 PM, Douglas A. Gwyn [EMAIL PROTECTED] wrote:
My question is, how to
impliment non-parallel loop/condition commands in Sam?
As you noticed, it's a different model from ed, sed, etc.
In sam, you can specify sequential edits on
2008/2/7, Hongzheng Wang [EMAIL PROTECTED]:
I see. The key point is to use external utilities, rather than depend
only on Sam itself. And not only the scripts you provided here but
also some specific utilies, say tac, can be applied in my question.
You could also use sed (I have never tried
Thank you for your advice.
Don't forget that you have a lot of text-oriented tools at
your disposal in any Unix or Plan 9 environment. To
reverse the order of lines within a file already opened by
sam, I would simply enter the following sam commands:
,| nl | sort -rn
,x/^
On Feb 7, 2008 8:33 PM, Hongzheng Wang [EMAIL PROTECTED] wrote:
To
reverse the order of lines within a file already opened by
sam, I would simply enter the following sam commands:
,| nl | sort -rn
,x/^ +[0-9]+/d
tac
Note that plan 9 has tail -r to reverse lines.
Thank you all very much.
I think I learned many interesting and useful tips, e.g. the -r option
of tail shipped by Plan9 during this conversation. And I still need
some time and experiences training myself to get used to the habits
and idioms of Sam.
--
HZ
Hi all,
I'm new to Plan9 and also this mailing list.
After some experience with Sam's structral regexp, I become quite
interested in this editor command. And I also noticed that the loop
and condition commands of Sam, say x, y, g, v etc, are somewhat
different from the commands of ed. For