Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Steve Simon


i wrote a cpu like client/server for windows (called dos). 

my code and test environment lived on a microsoft smb server. i ran cifs(1) to 
get access to this from plan9 and sam.

dos(1) allowed me to start an rc(1) running on win32 in the same directory as 
my current directory on plan9. it also kept my local /dev/wdir up to date with 
that on windows - massaging paths as needed.

all this allowed me to bounce between windows and plan9 fairly transparently 
like cpu(1) would on plan9. i could also plumb files i saw and plan9 would do 
the right thing.

it should use the cpu(1) protocol but i never got round to it - what i have 
just works.

my current employer uses Macs rather than windows so this has fallen into 
disuse.

i am happy to share if anyone has a use for it.

-Steve


--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M90430f1d0d3a94dcd370712f
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread Silas McCroskey
> #!/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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread Silas McCroskey
# 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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread revcomninos
*not ignored
--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mb735bb03a18063dea7599571
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread revcomninos
 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


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread hiro
if you don't already use drawterm anyway for other reasons, and you
only would like to set up ssh, and you already have a working 9p
server for linux (like u9fs), i don't think there's an immediate
benefit in switching to drawterm.

otoh if you already do use drawterm interactively for different
reasons, it is probably nice to know that you can abuse ssh to get the
same environment as exported by drawterm even when you happen to sit
on the wrong side of the pipe sometimes.

it's a bunch of inversions of directions, and it sounds complicated.
but i already have scripts ready for the use of drawterm, so it came
naturally.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-Mf8a2a371ccfd7948c69ca6e3
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread hiro
it's still equivalent, obviously you can start drawterm in the
background or in some persistent virtual terminal emulator.

and yes, both drawterm and ssh will use TCP below, the only difference
in the stack for the actual data would be that instead of SSH you
would have TLS for encryption.

On 7/21/21, Dan Cross  wrote:
> On Wed, Jul 21, 2021 at 1:32 PM Xiao-Yong Jin  wrote:
>
>> > On Jul 21, 2021, at 12:16 PM, Dan Cross  wrote:
>> >
>> > Nothing prevents you from invoking u9fs over an SSH connection; one
>> needn't run it from inetd, and I doubt anyone has in 20 years.
>>
>> You are right.  In that case, the only difference is just that,
>> citing hiro,
>>
>> yes it's a lot of back and forth, but ssh only is needed for
>> running
>> the process, the data afterwards can use 9p directly.
> 
> 
> It's unclear what that's supposed to mean. There's obviously still a
> transport involved; in one case, that's over (I presume) TLS over a TCP
> connection owned by drawterm, in the other, it's a bitstream running over
> the SSH protocol over TCP. In the former case, if the drawterm process on
> the Linux side dies for whatever reason, your imported resources disappear.
> In the latter, if the sshd or u9fs die, same.
> 
> Overall, this seems like abusing drawterm to do what u9fs (or other,
> similar userspace 9P servers) was (were) intended to do.
> 
> - Dan C.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-Me7a96cf8efb8514500af667a
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Dan Cross
On Wed, Jul 21, 2021 at 1:32 PM Xiao-Yong Jin  wrote:

> > On Jul 21, 2021, at 12:16 PM, Dan Cross  wrote:
> >
> > Nothing prevents you from invoking u9fs over an SSH connection; one
> needn't run it from inetd, and I doubt anyone has in 20 years.
>
> You are right.  In that case, the only difference is just that,
> citing hiro,
>
> yes it's a lot of back and forth, but ssh only is needed for
> running
> the process, the data afterwards can use 9p directly.


It's unclear what that's supposed to mean. There's obviously still a
transport involved; in one case, that's over (I presume) TLS over a TCP
connection owned by drawterm, in the other, it's a bitstream running over
the SSH protocol over TCP. In the former case, if the drawterm process on
the Linux side dies for whatever reason, your imported resources disappear.
In the latter, if the sshd or u9fs die, same.

Overall, this seems like abusing drawterm to do what u9fs (or other,
similar userspace 9P servers) was (were) intended to do.

- Dan C.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-Mbefc0794ea49365431f10fc4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread hiro
> This is using ssh to attach to the Linux machine to import it's filesystem
> into the plan9 namespace? Wouldn't authenticating from plan9 to Linux over
> SSH be independent of drawterm vs u9fs?

yes, if you only need files from the filesystem ssh might be
sufficient protection.
also, with additional use of sshnet you're not missing out against
drawterm's /net either.
so yes, for many things it can be equivalent.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M08fc0896d2d3b3889375ab02
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Xiao-Yong Jin
> On Jul 21, 2021, at 12:16 PM, Dan Cross  wrote:
> 
> Nothing prevents you from invoking u9fs over an SSH connection; one needn't 
> run it from inetd, and I doubt anyone has in 20 years.

You are right.  In that case, the only difference is just that,
citing hiro,

yes it's a lot of back and forth, but ssh only is needed for running
the process, the data afterwards can use 9p directly.


--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M0420f6421e0b56116336edff
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Dan Cross
On Wed, Jul 21, 2021 at 1:09 PM Xiao-Yong Jin  wrote:

> > On Jul 21, 2021, at 11:42 AM, Dan Cross  wrote:
> >
> > On Wed, Jul 21, 2021 at 12:17 PM Xiao-Yong Jin 
> wrote:
> > > On Jul 21, 2021, at 11:08 AM, Dan Cross  wrote:
> > > > ssh linuxpc drawterm -c srvdev.rc
> > > >
> > > > yes it's a lot of back and forth, but ssh only is needed for running
> > > > the process, the data afterwards can use 9p directly.
> > >
> > > What's the difference between that and using something like u9fs?
> >
> > auth?
> >
> > This is using ssh to attach to the Linux machine to import it's
> filesystem into the plan9 namespace? Wouldn't authenticating from plan9 to
> Linux over SSH be independent of drawterm vs u9fs?
>
> Drawterm does the proper auth and connect to the plan9 system.
> U9fs needs plan9 srv to auth and connect to it.
>
> If you are running a plan9 system, you probably have your auth
> setup.  If you have access to a posix system, you probably have ssh
> setup and you have access as a normal user, and that enables you
> to do ssh and drawterm back.  No additional setup required.
>
> U9fs, on the contrary, states
>
>   It is typically invoked on a Unix machine by
>   inetd with its standard input and output connected to a net-
>   work connection, typically TCP on an Ethernet.  It typically
>   runs as user root and multiplexes access to multiple Plan 9
>   clients over the single wire.  It assumes Plan 9 uids match
>   Unix login names, and changes to the corresponding Unix
>   effective uid when processing requests.
>
> I'm not going to run this and listen on a public interface even if
> it does not run as root.
>
> There are issues with the auth method that u9fs uses, which I'm not
> going to discuss here.


Nothing prevents you from invoking u9fs over an SSH connection; one needn't
run it from inetd, and I doubt anyone has in 20 years.

- Dan C.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M19bbcae898047761677de240
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Xiao-Yong Jin
> On Jul 21, 2021, at 11:42 AM, Dan Cross  wrote:
> 
> On Wed, Jul 21, 2021 at 12:17 PM Xiao-Yong Jin  wrote:
> > On Jul 21, 2021, at 11:08 AM, Dan Cross  wrote:
> > > ssh linuxpc drawterm -c srvdev.rc
> > >
> > > yes it's a lot of back and forth, but ssh only is needed for running
> > > the process, the data afterwards can use 9p directly.
> > 
> > What's the difference between that and using something like u9fs?
> 
> auth?
> 
> This is using ssh to attach to the Linux machine to import it's filesystem 
> into the plan9 namespace? Wouldn't authenticating from plan9 to Linux over 
> SSH be independent of drawterm vs u9fs?

Drawterm does the proper auth and connect to the plan9 system.
U9fs needs plan9 srv to auth and connect to it.

If you are running a plan9 system, you probably have your auth
setup.  If you have access to a posix system, you probably have ssh
setup and you have access as a normal user, and that enables you
to do ssh and drawterm back.  No additional setup required.

U9fs, on the contrary, states

  It is typically invoked on a Unix machine by
  inetd with its standard input and output connected to a net-
  work connection, typically TCP on an Ethernet.  It typically
  runs as user root and multiplexes access to multiple Plan 9
  clients over the single wire.  It assumes Plan 9 uids match
  Unix login names, and changes to the corresponding Unix
  effective uid when processing requests.

I'm not going to run this and listen on a public interface even if
it does not run as root.

There are issues with the auth method that u9fs uses, which I'm not
going to discuss here.
--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-Me0fbfb51e9d00650796490b0
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Dan Cross
On Wed, Jul 21, 2021 at 12:17 PM Xiao-Yong Jin  wrote:

> > On Jul 21, 2021, at 11:08 AM, Dan Cross  wrote:
> > > ssh linuxpc drawterm -c srvdev.rc
> > >
> > > yes it's a lot of back and forth, but ssh only is needed for running
> > > the process, the data afterwards can use 9p directly.
> >
> > What's the difference between that and using something like u9fs?
>
> auth?
>

This is using ssh to attach to the Linux machine to import it's filesystem
into the plan9 namespace? Wouldn't authenticating from plan9 to Linux over
SSH be independent of drawterm vs u9fs?

- Dan C.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M2452ff590f92aee3d7e33dfb
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Xiao-Yong Jin
> On Jul 21, 2021, at 11:08 AM, Dan Cross  wrote:
> 
> ssh linuxpc drawterm -c srvdev.rc
> 
> yes it's a lot of back and forth, but ssh only is needed for running
> the process, the data afterwards can use 9p directly.
> 
> What's the difference between that and using something like u9fs?

auth?

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M0b41c5534d3ffc52dae6bce7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Dan Cross
On Wed, Jul 21, 2021 at 11:12 AM hiro <23h...@gmail.com> wrote:

> if i want to serve files from a linux, i sometimes run drawterm on the
> linux, export stuff to an /srv and then access that from the other
> side.
>
> theoretically you can automate that also from the other side, make
> some script for the /srv stuff, and run it from 9front via ssh via
> drawterm:
>
> ssh linuxpc drawterm -c srvdev.rc
>
> yes it's a lot of back and forth, but ssh only is needed for running
> the process, the data afterwards can use 9p directly.
>

What's the difference between that and using something like u9fs?

- Dan C.

On 7/21/21, Xiao-Yong Jin  wrote:
> >> On Jul 20, 2021, at 10:52 PM, Lucio De Re  wrote:
> >>
> >> what would
> >> it take to serve 9P on Posix (in P9P, in other words) over the
> >> network? Fontsrv and gitsrv would be immediate beneficiaries.
> >
> > Just run it like,
> >
> > fontsrv -s 'tcp!192.168.9.2!1500'
> >
> > and I've no idea what gitsrv is.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M0fca6f2faa67aa5a68dafebd
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread hiro
if i want to serve files from a linux, i sometimes run drawterm on the
linux, export stuff to an /srv and then access that from the other
side.

theoretically you can automate that also from the other side, make
some script for the /srv stuff, and run it from 9front via ssh via
drawterm:

ssh linuxpc drawterm -c srvdev.rc

yes it's a lot of back and forth, but ssh only is needed for running
the process, the data afterwards can use 9p directly.

On 7/21/21, Xiao-Yong Jin  wrote:
>> On Jul 20, 2021, at 10:52 PM, Lucio De Re  wrote:
>>
>> what would
>> it take to serve 9P on Posix (in P9P, in other words) over the
>> network? Fontsrv and gitsrv would be immediate beneficiaries.
> 
> Just run it like,
> 
> fontsrv -s 'tcp!192.168.9.2!1500'
> 
> and I've no idea what gitsrv is.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-Mdb88673fa85a760087940e5e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: Posix implementation of Plan 9 cpu(1) (Was: [9fans] Command to set samterm label)

2021-07-21 Thread Xiao-Yong Jin
> On Jul 20, 2021, at 10:52 PM, Lucio De Re  wrote:
> 
> what would
> it take to serve 9P on Posix (in P9P, in other words) over the
> network? Fontsrv and gitsrv would be immediate beneficiaries.

Just run it like,

fontsrv -s 'tcp!192.168.9.2!1500'

and I've no idea what gitsrv is.

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T09fcdec9c87bfde4-M58a85fbab67058af61f54848
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread revcomninos
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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread umbraticus
> 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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread umbraticus
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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread revcomninos
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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread Alexander Kapshuk
On Wed, Jul 21, 2021 at 12:18 PM  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] https://9fans.topicbox.com/groups/9fans/T10b1d559ae7d981e-Mbddcbb3fb3e41229d32d0ca7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread umbraticus
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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread Rob Pike
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  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
> 
>

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


Re: [9fans] Help with a sam cleanup script

2021-07-21 Thread Rodrigo G . López
try with ssam(1).

% ssam -f thatscriptofyours somefile


-rodri

On Wed, Jul 21, 2021, 11:17 AM  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
> 
>

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


[9fans] Help with a sam cleanup script

2021-07-21 Thread revcomninos
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


Re: [9fans] sam label and rio snarf buffer

2021-07-21 Thread hiro
> Will cooperation come back to rescue this planet, or will it be too
> late? I suppose if one omits human exceptionalism, Nature will triumph
> by default. But it's going to hurt like hell!

works on my 9front

--
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc809ad6007ccd2bd-M1e9c386b7efe346683c407ea
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription