9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Help with a sam cleanup script
@ 2021-07-21  9:17 revcomninos
  2021-07-21  9:24 ` Rodrigo G. López
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: revcomninos @ 2021-07-21  9:17 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 984 bytes --]

In ed I have a cleanup script which I can apply to several files at once. The script removes things like blank lines and spaces between words. To run it on a file or multiple files, I type this command:
ed [name of file(s)] < cleanup-script
I converted all the regular expressions in the file into sam regex format and tried the same, but to no avail.  Here is a list of some of the commands:
.x s/\*//g
,x/^ +/s///
,x/ +$/s///
,x/  +/s// /
,x/^$\n/d
,x/‘‘|’’/s//"/
,x/“|”/s//"/
,x/‘|’/s//"/
,x/^ +/s///
,x/ +$/s///
,x/  +/s// /
,x/^$\n/d
,x/‘‘|’’/s//"/
,x/“|”/s//"/
,x/‘|’/s//"/
,x/teh/c/the/
wq
I am not even sure sam can do this, but if it can, I would appreciate some guidance on how to do it. 


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M81420cb8a514930c24cd6ad6
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2333 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21  9:17 [9fans] Help with a sam cleanup script revcomninos
@ 2021-07-21  9:24 ` Rodrigo G. López
  2021-07-21  9:24 ` Rob Pike
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 28+ messages in thread
From: Rodrigo G. López @ 2021-07-21  9:24 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1551 bytes --]

try with ssam(1).

% ssam -f thatscriptofyours somefile


-rodri

On Wed, Jul 21, 2021, 11:17 AM <revcomninos@gmail.com> wrote:

> In ed I have a cleanup script which I can apply to several files at once.
> The script removes things like blank lines and spaces between words. To run
> it on a file or multiple files, I type this command:
> ed [name of file(s)] < cleanup-script
> I converted all the regular expressions in the file into sam regex format
> and tried the same, but to no avail.  Here is a list of some of the
> commands:
>
> .x s/\*//g
> ,x/^ +/s///
> ,x/ +$/s///
> ,x/  +/s// /
> ,x/^$\n/d
> ,x/‘‘|’’/s//"/
> ,x/“|”/s//"/
> ,x/‘|’/s//"/
> ,x/^ +/s///
> ,x/ +$/s///
> ,x/  +/s// /
> ,x/^$\n/d
> ,x/‘‘|’’/s//"/
> ,x/“|”/s//"/
> ,x/‘|’/s//"/
> ,x/teh/c/the/
> wq
>
> I am not even sure sam can do this, but if it can, I would appreciate
> some guidance on how to do it.
>
>
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M81420cb8a514930c24cd6ad6>
>

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M346a55911fc933521d3d3f07
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2797 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21  9:17 [9fans] Help with a sam cleanup script revcomninos
  2021-07-21  9:24 ` Rodrigo G. López
@ 2021-07-21  9:24 ` Rob Pike
  2021-07-21  9:28 ` umbraticus
  2021-07-21  9:52 ` Alexander Kapshuk
  3 siblings, 0 replies; 28+ messages in thread
From: Rob Pike @ 2021-07-21  9:24 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 2315 bytes --]

There are many things here that feel wrong or at least inelegant, starting
with the first character. Surely you mean a comma not a period. You are
also inconsistent: sometimes you use x to find the pattern and then change
it, sometimes you use a substitute. It's more efficient in both time and
keystrokes to use c or d when you can:

,x/‘‘|’’/c/"/

,x/\*/d


for example.

But overall: If you show us either the ed script you use, or a precise
definition of the problem, people could offer solutions. I assure you sam
can do this; it's far more powerful than ed.

But then: Why not use ed if you have a working script? Or are you just
trying to understand sam better? The docs for sam are complete. Lose your
line orientation and think of the file as a single string. That's how sam
works.

-rob




On Wed, Jul 21, 2021 at 7:18 PM <revcomninos@gmail.com> wrote:

> In ed I have a cleanup script which I can apply to several files at once.
> The script removes things like blank lines and spaces between words. To run
> it on a file or multiple files, I type this command:
> ed [name of file(s)] < cleanup-script
> I converted all the regular expressions in the file into sam regex format
> and tried the same, but to no avail.  Here is a list of some of the
> commands:
>
> .x s/\*//g
> ,x/^ +/s///
> ,x/ +$/s///
> ,x/  +/s// /
> ,x/^$\n/d
> ,x/‘‘|’’/s//"/
> ,x/“|”/s//"/
> ,x/‘|’/s//"/
> ,x/^ +/s///
> ,x/ +$/s///
> ,x/  +/s// /
> ,x/^$\n/d
> ,x/‘‘|’’/s//"/
> ,x/“|”/s//"/
> ,x/‘|’/s//"/
> ,x/teh/c/the/
> wq
>
> I am not even sure sam can do this, but if it can, I would appreciate
> some guidance on how to do it.
>
>
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M81420cb8a514930c24cd6ad6>
>

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mcecc24b77fbe2df7b744e4f9
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 4156 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21  9:17 [9fans] Help with a sam cleanup script revcomninos
  2021-07-21  9:24 ` Rodrigo G. López
  2021-07-21  9:24 ` Rob Pike
@ 2021-07-21  9:28 ` umbraticus
  2021-07-21 10:02   ` revcomninos
  2021-07-21  9:52 ` Alexander Kapshuk
  3 siblings, 1 reply; 28+ messages in thread
From: umbraticus @ 2021-07-21  9:28 UTC (permalink / raw)
  To: 9fans

you probably want to use ssam (no wq required)

what isn't working? some suggestions:

,x/‘‘|’’/s//"/ and ,x/‘|’/s//"/ → ,x/[“‘’”]/c/"
.x s/\*//g → ,x/\*/d
,x/^ +/s/// → ,x/^ +/d
,x/ +$/s/// → ,x/ +$/d
,x/  +/s// / → ,x/  +/c/ /

take your time, learn the language, & enjoy

umbraticus

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M7713c653ed3bb3ebbe17be73
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21  9:17 [9fans] Help with a sam cleanup script revcomninos
                   ` (2 preceding siblings ...)
  2021-07-21  9:28 ` umbraticus
@ 2021-07-21  9:52 ` Alexander Kapshuk
  2021-07-21 10:09   ` umbraticus
  3 siblings, 1 reply; 28+ messages in thread
From: Alexander Kapshuk @ 2021-07-21  9:52 UTC (permalink / raw)
  To: 9fans

On Wed, Jul 21, 2021 at 12:18 PM <revcomninos@gmail.com> wrote:
>
> In ed I have a cleanup script which I can apply to several files at once. The script removes things like blank lines and spaces between words. To run it on a file or multiple files, I type this command:
> ed [name of file(s)] < cleanup-script
> I converted all the regular expressions in the file into sam regex format and tried the same, but to no avail.  Here is a list of some of the commands:
>
> .x s/\*//g
> ,x/^ +/s///
> ,x/ +$/s///
> ,x/  +/s// /
> ,x/^$\n/d
> ,x/‘‘|’’/s//"/
> ,x/“|”/s//"/
> ,x/‘|’/s//"/
> ,x/^ +/s///
> ,x/ +$/s///
> ,x/  +/s// /
> ,x/^$\n/d
> ,x/‘‘|’’/s//"/
> ,x/“|”/s//"/
> ,x/‘|’/s//"/
> ,x/teh/c/the/
> wq
>
> I am not even sure sam can do this, but if it can, I would appreciate some guidance on how to do it.
>
>
> 9fans / 9fans / see discussions + participants + delivery options Permalink

As far as having sam commands apply to multiple files, the X command is there:
sam(1):
X/regexp/ command
               For each file whose menu entry matches the regular
expression, make that the current file and run the command.
               If the expression is omitted, the command is run in every file.

Given these target files:
grep . file[12]
file1:line1
file2:line2

And a file that contains some sam commands:
cat cmd
X ,p
q

The following output is printed:
sam -d file[12] <cmd
 -. file1
line1
 -  file2
line2

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mbddcbb3fb3e41229d32d0ca7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21  9:28 ` umbraticus
@ 2021-07-21 10:02   ` revcomninos
  2021-07-21 10:19     ` umbraticus
  0 siblings, 1 reply; 28+ messages in thread
From: revcomninos @ 2021-07-21 10:02 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 961 bytes --]

Thank you all for your responses. I will carefully study the suggestions  provided. sam is new to me and I am trying hard to learn it.  There are obvious errors in the script I provided and I apologise for those. I could as Rob suggested simply apply the ed script, but I am trying to learn sam's way of doing things. 

As for

% ssam -f thatscriptofyours somefile

It gave me this error:

bash: fg: %: no such job

Here is the ed script :
g/\*/s///g
# g/[0-9]/s///g
g/  *$/s///
g/   */s// /g
g/\(‘‘\|’’\)/s//"/g
g/\(“\|”\)/s//"/g
g/\(‘\|’\)/s//'/g
g/\\p/s//\
\
\
/gp
g/\\b/s//\
\
\
/gp
g/^  */s///
v/./.,/./-1j
# Replace two or more blank lines with a single blank line in Ed
wq



------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M20a4b0b4cf349f08a5bc0e9d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 2863 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21  9:52 ` Alexander Kapshuk
@ 2021-07-21 10:09   ` umbraticus
  2021-07-26 14:17     ` revcomninos
  0 siblings, 1 reply; 28+ messages in thread
From: umbraticus @ 2021-07-21 10:09 UTC (permalink / raw)
  To: 9fans

also worth mentioning the ^ command if you're using 9front's sam.
put your sam commands in script like this:

#!/bin/rc
cat << STOP
x/  +/c/ 
x/\*/d
STOP

then you can run ^script and it will apply the commands.
Note that if you leave off the commas before the commands,
as I have above, you will have to set dot before running ^
but this allows more flexibility, eg. you can apply the edits
to a section of a document instead of always the whole thing.

One step at a time, though.

It would be neat if you could use ! ^ < > _ | in conjunction with X…

umbraticus

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M2e7ac6c9ebf53e2d3cd2bfec
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 10:02   ` revcomninos
@ 2021-07-21 10:19     ` umbraticus
  2021-07-21 10:49       ` revcomninos
  0 siblings, 1 reply; 28+ messages in thread
From: umbraticus @ 2021-07-21 10:19 UTC (permalink / raw)
  To: 9fans

> bash: fg: %: no such job

The % is a prompt: ignore it.

I think your script boils down to something like:

,x/\*|^ +| +$/d
,x/  +//c/ 
,x/[‘‘’’“”‘’]/c/"
,x/\\p|\\b/c/\n\n\n
,x/\n\n+/c/\n

umbraticus

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M75c05feaef122451a0351d21
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 10:19     ` umbraticus
@ 2021-07-21 10:49       ` revcomninos
  2021-07-21 18:36         ` revcomninos
  0 siblings, 1 reply; 28+ messages in thread
From: revcomninos @ 2021-07-21 10:49 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

Awesome. Thank you. I can hardly believe you have managed to reduce all those commands to just a few. I will test this and revert back.
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M093404c48ec88dcc971cf6aa
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 857 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 10:49       ` revcomninos
@ 2021-07-21 18:36         ` revcomninos
  2021-07-21 18:47           ` revcomninos
  0 siblings, 1 reply; 28+ messages in thread
From: revcomninos @ 2021-07-21 18:36 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

 I have tested all these solutions and they work. I can now apply the script (now significantly improved) from within sam and also from the command line with ssam. I will keep these posts as examples. The only question that remains is how to add comments to this script. If I use # it is ignored. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mcd0f0d6b71a7467bcf04d8ba
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1024 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 18:36         ` revcomninos
@ 2021-07-21 18:47           ` revcomninos
  2021-07-21 20:40             ` Silas McCroskey
  0 siblings, 1 reply; 28+ messages in thread
From: revcomninos @ 2021-07-21 18:47 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

*not ignored
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mb735bb03a18063dea7599571
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 728 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 18:47           ` revcomninos
@ 2021-07-21 20:40             ` Silas McCroskey
  2021-07-21 20:41               ` Silas McCroskey
  0 siblings, 1 reply; 28+ messages in thread
From: Silas McCroskey @ 2021-07-21 20:40 UTC (permalink / raw)
  To: 9fans

# is, for better or for worse, an address in sam:

          #n   The empty string after character n; #0 is the beginning
               of the file.

If you're talking about running the script with ^, it's just an
executable. You can put whatever you want in the shebang line; I tend
to use the following:

#!/bin/sed '/^#/d'
# this line is ignored
,x/\*|^ +| +$/d
# this line is also ignored
,x/  +//c/
,x/[‘‘’’“”‘’]/c/"
,x/\\p|\\b/c/\n\n\n
,x/\n\n+/c/\n

Running this as a script outputs only the lines in the file not
beginning with # for interpretation by sam.

To use it with ssam -f, you'd have to use the output rather than the
file directly.

In rc: ssam -f <{script}
In bash: ssam -f <(script)

both send the output to a temporary fd and then return a virtual file
path to that fd for commands like this that expect a file path.

If you really want comments within the sam language itself, the best I
came up with after 5 minutes of thinking was:

x/$^/!#

i.e. run a commented out shell command when an impossible pattern is
matched. The x// is needed to avoid actually launching the shell, and
the !# is needed to avoid interpreting the characters following as
another sam command (even if it's one that would never be run).

- Silas

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mafc9e9d330eaec6c6ad1fe81
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 20:40             ` Silas McCroskey
@ 2021-07-21 20:41               ` Silas McCroskey
  2021-07-22  9:51                 ` revcomninos
  0 siblings, 1 reply; 28+ messages in thread
From: Silas McCroskey @ 2021-07-21 20:41 UTC (permalink / raw)
  To: 9fans

> #!/bin/sed '/^#/d'

apologies. quotes do not belong there.

#!/bin/sed /^#/d

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mfff65af821d77519fd6c8034
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 20:41               ` Silas McCroskey
@ 2021-07-22  9:51                 ` revcomninos
  0 siblings, 0 replies; 28+ messages in thread
From: revcomninos @ 2021-07-22  9:51 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

Thank you so much Silas for your detailed and informative response. I have settled on accepting your second solution x/$^/!# for the time being. It gives me just the result I need. I use the commented lines mostly as a mnemonic device to recall the meaning of complex commands. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M95f7688f18e84b201bee87fb
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1729 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-21 10:09   ` umbraticus
@ 2021-07-26 14:17     ` revcomninos
  2021-07-26 21:07       ` ori
  0 siblings, 1 reply; 28+ messages in thread
From: revcomninos @ 2021-07-26 14:17 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

On Wednesday, 21 July 2021, at 12:09 PM, umbraticus wrote:
> also worth mentioning the ^ command if you're using 9front's sam.
put your sam commands in script like this:

#!/bin/rc
cat << STOP
x/  +/c/ 
x/\*/d
STOP
I cannot get ^script to work from within sam. I do have 9front's sam installed but there does not seem to be a ^ command in the version I am using. I am running sam as a standalone on Debian Linux. Can you provide a concrete example?
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M6a9e47f734477d40f02037db
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1251 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-26 14:17     ` revcomninos
@ 2021-07-26 21:07       ` ori
  2021-07-27  3:07         ` Mark van Atten
  0 siblings, 1 reply; 28+ messages in thread
From: ori @ 2021-07-26 21:07 UTC (permalink / raw)
  To: 9fans

Quoth revcomninos@gmail.com:
> I do have 9front's sam installed
> I am running sam as a standalone on Debian Linux

9front's sam does not run on Debian linux.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Me2552dd83a5356a73cdab18d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-26 21:07       ` ori
@ 2021-07-27  3:07         ` Mark van Atten
  2021-07-27  6:32           ` revcomninos
                             ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Mark van Atten @ 2021-07-27  3:07 UTC (permalink / raw)
  To: 9fans

On Mon, 26 Jul 2021 at 23:08, <ori@eigenstate.org> wrote:
>
> Quoth revcomninos@gmail.com:
> > I do have 9front's sam installed
> > I am running sam as a standalone on Debian Linux
>
> 9front's sam does not run on Debian linux.

There is a port, now no longer active:
https://bitbucket-archive.softwareheritage.org/projects/ir/iru/sam9f-unix.html

Mark.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Me3671f8e9073b8bd8146cd0e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27  3:07         ` Mark van Atten
@ 2021-07-27  6:32           ` revcomninos
  2021-07-27  6:33           ` revcomninos
  2021-07-27 13:23           ` Iruatã Souza
  2 siblings, 0 replies; 28+ messages in thread
From: revcomninos @ 2021-07-27  6:32 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

On Monday, 26 July 2021, at 11:07 PM, ori wrote:
> 9front's sam does not run on Debian linux.
I assumed the version of sam that I downloaded from here: https://9fans.github.io/plan9port/ was 9front' sam. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M52b8f501a6a5101381347075
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1054 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27  3:07         ` Mark van Atten
  2021-07-27  6:32           ` revcomninos
@ 2021-07-27  6:33           ` revcomninos
  2021-07-27 13:23           ` Iruatã Souza
  2 siblings, 0 replies; 28+ messages in thread
From: revcomninos @ 2021-07-27  6:33 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

In any event, is there not a way to run the script from within sam without using that particular version?
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M5ba554cb9f33ef440fb7c81e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27  3:07         ` Mark van Atten
  2021-07-27  6:32           ` revcomninos
  2021-07-27  6:33           ` revcomninos
@ 2021-07-27 13:23           ` Iruatã Souza
  2021-07-27 13:28             ` Mark van Atten
                               ` (2 more replies)
  2 siblings, 3 replies; 28+ messages in thread
From: Iruatã Souza @ 2021-07-27 13:23 UTC (permalink / raw)
  To: 9fans, Mark van Atten

On 7/27/21 5:07 AM, Mark van Atten wrote:
> On Mon, 26 Jul 2021 at 23:08, <ori@eigenstate.org> wrote:
>>
>> Quoth revcomninos@gmail.com:
>>> I do have 9front's sam installed
>>> I am running sam as a standalone on Debian Linux
>>
>> 9front's sam does not run on Debian linux.
> 
> There is a port, now no longer active:
> https://bitbucket-archive.softwareheritage.org/projects/ir/iru/sam9f-unix.html
> 

Just pushed it to https://github.com/iru-/sam9f-unix. It might be
outdated, but I still use it daily.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mb8759e7610beacd11fa5329d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27 13:23           ` Iruatã Souza
@ 2021-07-27 13:28             ` Mark van Atten
  2021-07-27 13:39             ` kvik
  2021-08-03 16:30             ` revcomninos
  2 siblings, 0 replies; 28+ messages in thread
From: Mark van Atten @ 2021-07-27 13:28 UTC (permalink / raw)
  To: Iruatã Souza; +Cc: 9fans

On Tue, 27 Jul 2021 at 15:23, Iruatã Souza <iru.muzgo@gmail.com> wrote:
> Just pushed it to https://github.com/iru-/sam9f-unix. It might be
> outdated, but I still use it daily.

Many thanks for this!

Mark.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M709aaf85a4881ce3f4b7207d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27 13:23           ` Iruatã Souza
  2021-07-27 13:28             ` Mark van Atten
@ 2021-07-27 13:39             ` kvik
  2021-07-27 14:14               ` Jacob Moody
  2021-07-28 11:25               ` Iruatã Souza
  2021-08-03 16:30             ` revcomninos
  2 siblings, 2 replies; 28+ messages in thread
From: kvik @ 2021-07-27 13:39 UTC (permalink / raw)
  To: 9fans

> Just pushed it to https://github.com/iru-/sam9f-unix. It might be
> outdated, but I still use it daily.

It seems that you imported two months before '^' and '_' got added
(in 758496ecaa42b5f6c17c0bd1e0f43189e50e0745).

There have been a few other changes very useful for scripting, like
the $% and $%dot variables exported to forked procs giving a current
file name and selection.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M35ad586644fb7a38a1960a1a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27 13:39             ` kvik
@ 2021-07-27 14:14               ` Jacob Moody
  2021-07-28 11:25               ` Iruatã Souza
  1 sibling, 0 replies; 28+ messages in thread
From: Jacob Moody @ 2021-07-27 14:14 UTC (permalink / raw)
  To: 9fans

On 7/27/21 7:39 AM, kvik@a-b.xyz wrote:
>> Just pushed it to https://github.com/iru-/sam9f-unix. It might be
>> outdated, but I still use it daily.
> 
> It seems that you imported two months before '^' and '_' got added
> (in 758496ecaa42b5f6c17c0bd1e0f43189e50e0745).
> 
> There have been a few other changes very useful for scripting, like
> the $% and $%dot variables exported to forked procs giving a current
> file name and selection.
> 

I have done some work in porting 9front sam changes to a fork of the go sam port.
You can find the work here:
https://github.com/majiru/go/tree/frontsam

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M23c2702dda25e6393ba969fb
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27 13:39             ` kvik
  2021-07-27 14:14               ` Jacob Moody
@ 2021-07-28 11:25               ` Iruatã Souza
  2021-08-03 15:04                 ` fwrm via 9fans
  1 sibling, 1 reply; 28+ messages in thread
From: Iruatã Souza @ 2021-07-28 11:25 UTC (permalink / raw)
  To: 9fans, kvik

On 7/27/21 3:39 PM, kvik@a-b.xyz wrote:
>> Just pushed it to https://github.com/iru-/sam9f-unix. It might be
>> outdated, but I still use it daily.
> 
> It seems that you imported two months before '^' and '_' got added
> (in 758496ecaa42b5f6c17c0bd1e0f43189e50e0745).
> 
> There have been a few other changes very useful for scripting, like
> the $% and $%dot variables exported to forked procs giving a current
> file name and selection.
> 

Thanks, updated to 9front commit 70d173bfa.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Md05846b2092ab3e9e7f99e6f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-28 11:25               ` Iruatã Souza
@ 2021-08-03 15:04                 ` fwrm via 9fans
  2021-08-03 16:29                   ` fwrm via 9fans
  0 siblings, 1 reply; 28+ messages in thread
From: fwrm via 9fans @ 2021-08-03 15:04 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]

> In any event, is there not a way to run the script from within sam without using that particular version?

There is:
,| ssam -f your_script
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M4bd20ac371578e1e0514911e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1172 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-08-03 15:04                 ` fwrm via 9fans
@ 2021-08-03 16:29                   ` fwrm via 9fans
  0 siblings, 0 replies; 28+ messages in thread
From: fwrm via 9fans @ 2021-08-03 16:29 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

As for comments in scripts, if you use ssam(1) to run them the easiest way would be starting the lines you want to be ignored with a character that isn't a sam command (this will work because ssam sends stderr to /dev/null).
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M0ec1abfa8e992698915509ca
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 944 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-07-27 13:23           ` Iruatã Souza
  2021-07-27 13:28             ` Mark van Atten
  2021-07-27 13:39             ` kvik
@ 2021-08-03 16:30             ` revcomninos
  2021-08-03 18:03               ` Charles Forsyth
  2 siblings, 1 reply; 28+ messages in thread
From: revcomninos @ 2021-08-03 16:30 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On Tuesday, 3 August 2021, at 6:29 PM, fwrm wrote:
> As for comments in scripts, if you use ssam(1) to run them the easiest way would be starting the lines you want to be ignored with a character that isn't a sam command (this will work because ssam sends stderr to /dev/null).
I am very grateful to you for this. Thanks so much. 
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M70e3d776bf3670824bf03f7e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1122 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [9fans] Help with a sam cleanup script
  2021-08-03 16:30             ` revcomninos
@ 2021-08-03 18:03               ` Charles Forsyth
  0 siblings, 0 replies; 28+ messages in thread
From: Charles Forsyth @ 2021-08-03 18:03 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

to avoid errors, perhaps something along the lines of

X g/$/v/$/a
this is a long block comment.
it has no effect.
.

X prevents ?no current file

there are probably even shorter variants

On Tue, Aug 3, 2021 at 5:31 PM <revcomninos@gmail.com> wrote:

> On Tuesday, 3 August 2021, at 6:29 PM, fwrm wrote:
>
> As for comments in scripts, if you use ssam(1) to run them the easiest way
> would be starting the lines you want to be ignored with a character that
> isn't a sam command (this will work because ssam sends stderr to /dev/null).
>
> I am very grateful to you for this. Thanks so much.
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-M70e3d776bf3670824bf03f7e>
>

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mc443cf253463a264c625ac19
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1731 bytes --]

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2021-08-03 18:03 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21  9:17 [9fans] Help with a sam cleanup script revcomninos
2021-07-21  9:24 ` Rodrigo G. López
2021-07-21  9:24 ` Rob Pike
2021-07-21  9:28 ` umbraticus
2021-07-21 10:02   ` revcomninos
2021-07-21 10:19     ` umbraticus
2021-07-21 10:49       ` revcomninos
2021-07-21 18:36         ` revcomninos
2021-07-21 18:47           ` revcomninos
2021-07-21 20:40             ` Silas McCroskey
2021-07-21 20:41               ` Silas McCroskey
2021-07-22  9:51                 ` revcomninos
2021-07-21  9:52 ` Alexander Kapshuk
2021-07-21 10:09   ` umbraticus
2021-07-26 14:17     ` revcomninos
2021-07-26 21:07       ` ori
2021-07-27  3:07         ` Mark van Atten
2021-07-27  6:32           ` revcomninos
2021-07-27  6:33           ` revcomninos
2021-07-27 13:23           ` Iruatã Souza
2021-07-27 13:28             ` Mark van Atten
2021-07-27 13:39             ` kvik
2021-07-27 14:14               ` Jacob Moody
2021-07-28 11:25               ` Iruatã Souza
2021-08-03 15:04                 ` fwrm via 9fans
2021-08-03 16:29                   ` fwrm via 9fans
2021-08-03 16:30             ` revcomninos
2021-08-03 18:03               ` Charles Forsyth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).