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

2021-08-03 Thread Charles Forsyth
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 wrote: > On Tuesday, 3 August 2021, at 6:29 PM, fwrm wrote: > > As for

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

2021-08-03 Thread revcomninos
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

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

2021-08-03 Thread fwrm via 9fans
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:

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

2021-08-03 Thread fwrm via 9fans
> 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

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

2021-07-28 Thread Iruatã Souza
On 7/27/21 3:39 PM, k...@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

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

2021-07-27 Thread Jacob Moody
On 7/27/21 7:39 AM, k...@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

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

2021-07-27 Thread kvik
> 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 $%

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

2021-07-27 Thread Mark van Atten
On Tue, 27 Jul 2021 at 15:23, Iruatã Souza 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:

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

2021-07-27 Thread Iruatã Souza
On 7/27/21 5:07 AM, Mark van Atten wrote: > On Mon, 26 Jul 2021 at 23:08, wrote: >> >> Quoth revcomni...@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

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

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

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

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

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

2021-07-26 Thread Mark van Atten
On Mon, 26 Jul 2021 at 23:08, wrote: > > Quoth revcomni...@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:

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

2021-07-26 Thread ori
Quoth revcomni...@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:

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

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

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

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

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:

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

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

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

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:

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

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

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

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

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

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

[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