From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14952 invoked from network); 21 Jul 2021 09:25:20 -0000 Received: from tb-ob0.topicbox.com (64.147.108.117) by inbox.vuxu.org with ESMTPUTF8; 21 Jul 2021 09:25:20 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob0.topicbox.com (Postfix) with ESMTP id 057EA3584A for ; Wed, 21 Jul 2021 05:25:19 -0400 (EDT) (envelope-from bounce.mMcecc24b77fbe2df7b744e4f9.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id 020BA2E05643; Wed, 21 Jul 2021 05:25:19 -0400 (EDT) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=kAG79hEZ header.a=rsa-sha256 header.s=20161025 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=robpike@gmail.com smtp.helo=mail-pg1-f178.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (body has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type:list-help:list-id:list-post :list-subscribe:reply-to:content-transfer-encoding :list-unsubscribe; s=sysmsg-1; t=1626859518; bh=kDgYA6OXwvyKv7BP tP+Fy7VsH4LodcCcXK7F9IjtH1w=; b=iGRF5Hsz0VPforclhyjdcFNeowsymLA0 fI77UrBi9dv8aRWiXN4pP7lEyK/43RAUHs6XkiNvHSz9XoYGSSWrSZKlG3eOjJGl qvxhDhHFD8Mw264bkQYuS1xEBn1t3SDlm45dCaHdOVpracdjDha9nyjZEnPGtj+0 xsddbuvWkVA= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1626859518; b=m3mU0kSxhgv7CinMLLMegsg6oA6SzgbfTfvfuzZT3loqEq9fsz HQxYRj6q5wwG/dXfcvzahrGx3kZ+SLO6B2jXiPNT0uDi8ZL8Y58gjylDmPkUIO1E CRgESO0eE78f6RKA+c9JuMEvSjDAWAttZzNuzZyleesIkaPToWg4hcBTA= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=kAG79hEZ header.a=rsa-sha256 header.s=20161025 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=robpike@gmail.com smtp.helo=mail-pg1-f178.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (body has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=kAG79hEZ header.a=rsa-sha256 header.s=20161025 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.215.178 (mail-pg1-f178.google.com); spf=pass smtp.mailfrom=robpike@gmail.com smtp.helo=mail-pg1-f178.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=nHqNJs4Y; x-me-sender=none; x-ptr=pass smtp.helo=mail-pg1-f178.google.com policy.ptr=mail-pg1-f178.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h= mime-version:references:in-reply-to:from:date:message-id:subject :to:content-type:list-help:list-id:list-post:list-subscribe :reply-to:content-transfer-encoding:list-unsubscribe; s=dkim-1; bh=O2t74KYwrkGG8+jSAwQzM+O86FL4QUnREZdmzNYiWac=; b=VrqXr1YETOpe /pGCihlykDZHrgbNy5RcsqPl8CnpI5nwKh61fnLChBb1sOJ6kTeuBhewjZlHVRcu xFNjH1YZ2F9i2Jr8g+nht9UecQQPauh5dVm6xXSNBDnxl4KRBvCX7edbupI2d/JF yhC/xJuL9bsfSDulTjcyukXShCVtw3Y= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id F2DFA2E187EA for <9fans@9fans.net>; Wed, 21 Jul 2021 05:25:07 -0400 (EDT) (envelope-from robpike@gmail.com) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id F0D37E2B2C8; Wed, 21 Jul 2021 05:25:07 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1626859507; b=IGAoC/7z737X/s5Q41hv9z1K33RmK9eIxbpwI3UcPzCm07VBun 7mkSS4CfMnKgoTKTCryrjXRGaZmK+kBrSf+R+rSH2QfbR+l/wFHG3Cmh+hbHIU0f p163SfhbYIiLyC+mU3PRYTb2zb8ZlMxQahUdvVGfQgSK2LPTZSHmyuoCjykJhhpE Cs1RcKreXfHsF3Qd900b5oyzK5AerPNma3iBbFLz3SUIMYhVkEVyxKmrlaatx0YD i3Q3daAThXExBH9/uFQbygJ1qVsQMUUYgC4pznbRhF0XYOwXETq/ZoQTV5Nkidyn dfBzj6iDH0l5dj16KuCFJCuyuXzHk0KlV2Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; s=arcseal; t=1626859507; bh=SiIL7pn7m+bAl9dRUyVPw9VSpuBZEvBle4JAYT3sy94=; b=USjwrvfgt0j7 Q1S9Lz5YKoDx5REaHUmG/8jf9NBGdk6XC9JgQ1uImvQW59LTsUbTGH+JO9qolkwU kdsTcxE7KftQWzGpchzGRBL+E8V1lkAkNG4ZwYH7shQBNITthh8tJ2VAOgox4ZlA Wnvn6P/stGF912n44IpnGHWql987AGgegdnjraSFOJkafV1aHJVznd9HXPblt3iF 4EIsT977nvVBcDifOgkEHd//WhH2NIjdjoXcI/HvuYp2tEQa5BCakY7WzpDYV8uT h4YMHSOLFPj4GZTpDNuMFERSk5f7rJbSy3lP7zcJ+FOkaQ0tMBkvZbpphvaTiNBx FJ3e31mKnw== ARC-Authentication-Results: i=1; tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=kAG79hEZ header.a=rsa-sha256 header.s=20161025 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.215.178 (mail-pg1-f178.google.com); spf=pass smtp.mailfrom=robpike@gmail.com smtp.helo=mail-pg1-f178.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=nHqNJs4Y; x-me-sender=none; x-ptr=pass smtp.helo=mail-pg1-f178.google.com policy.ptr=mail-pg1-f178.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt1.gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt4.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvtddrfeefgdduudekucdltddurdegudelrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgf nhhsuhgsshgtrhhisggvpdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttd enucenucfjughrpeggfhgjhfffkffuvfgtsegrtderredttdejnecuhfhrohhmpeftohgs ucfrihhkvgcuoehrohgsphhikhgvsehgmhgrihhlrdgtohhmqeenucggtffrrghtthgvrh hnpeeihedtuddtjedtveegudffffekjefgueeggeegffevhffhleelfedtvdehvedtveen ucffohhmrghinhepthhophhitggsohigrdgtohhmnecukfhppedvtdelrdekhedrvdduhe drudejkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvtdel rdekhedrvdduhedrudejkedphhgvlhhopehmrghilhdqphhguddqfhdujeekrdhgohhogh hlvgdrtghomhdpmhgrihhlfhhrohhmpeeorhhosghpihhkvgesghhmrghilhdrtghomheq X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (gmail.com ... _spf.google.com: Sender is authorized to use 'robpike@gmail.com' in 'mfrom' identity (mechanism 'include:_netblocks.google.com' matched)) receiver=tb-mx1.topicbox.com; identity=mailfrom; envelope-from="robpike@gmail.com"; helo=mail-pg1-f178.google.com; client-ip=209.85.215.178 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx1.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Wed, 21 Jul 2021 05:25:07 -0400 (EDT) (envelope-from robpike@gmail.com) Received: by mail-pg1-f178.google.com with SMTP id u14so1281099pga.11 for <9fans@9fans.net>; Wed, 21 Jul 2021 02:25:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=SiIL7pn7m+bAl9dRUyVPw9VSpuBZEvBle4JAYT3sy94=; b=nHqNJs4YB0YgYgRI5lQh3WKc5S6H04cdhHId8aKMNKcpUQSj1sQqSx57+egbqimNa8 FGN1DfTDoaL3e3jpIGT7jc8A7z1vDuZ9VwYdC6QTvlzAPDb8tEjNAPkqu2DPZBZRLpIU OBU3siy3y8UOme2vtCPISJqOMtH+Tx8dUYgaJ/F0D6Itl1NTjd+kIvFmQukdjvhyv1vv nV8MCids3yBeTAhVNvrIAAUwO/k6N4d96JufJaSSWlynmM+4dTPmya2t9og1v9VPTLIr Z4ay+v2FC8q6bul4M/109ERb3tCrtw9gFQrT6UlZS4VV8iHaTpDndxhDJHcQRrDNLO3I FfAw== X-Gm-Message-State: AOAM531iG2VLeDKtbk0ce8kMXRRBdMfQ5L/cJQtfZJkjbyWI6/K1MgKH WUTv0jtM9aXaPMHnhk45zV1ESDxLZXerB8u8wG+hyQPycuTG/g== X-Google-Smtp-Source: ABdhPJxW4q7X4i6SmBC/Gtc17IgyfxQzoma94Aeo/X9NV4og2ihfHGJZgawu5YjsgAxCPtBAsVxMn2GQurZ/ZIXOREM= X-Received: by 2002:a65:6487:: with SMTP id e7mr34959218pgv.27.1626859506194; Wed, 21 Jul 2021 02:25:06 -0700 (PDT) MIME-Version: 1.0 References: <16268590350.573C31.33295@composer.9fans.topicbox.com> In-Reply-To: <16268590350.573C31.33295@composer.9fans.topicbox.com> From: Rob Pike Date: Wed, 21 Jul 2021 19:24:55 +1000 Message-ID: Subject: Re: [9fans] Help with a sam cleanup script To: 9fans <9fans@9fans.net> Content-Type: multipart/alternative; boundary="000000000000f75d1d05c79ebecb" Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 8d7e8e56-ea05-11eb-91cc-f7a26a9b87b9 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UMTBiMWQ1NTlhZTdkOTgxZS1NY2VjYzI0Yjc3ZmJlMmRmN2I3NDRl?= =?UTF-8?B?NGY5Pg==?= List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> Content-Transfer-Encoding: 7bit List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:Mcecc24b77fbe2df7b744e4f9:1:Lx2DVSJFKKrDfSvCsM0-o4SbzU57FwqjNUCZzEjGgOg --000000000000f75d1d05c79ebecb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/=E2=80=98=E2=80=98|=E2=80=99=E2=80=99/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 r= un > 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/=E2=80=98=E2=80=98|=E2=80=99=E2=80=99/s//"/ > ,x/=E2=80=9C|=E2=80=9D/s//"/ > ,x/=E2=80=98|=E2=80=99/s//"/ > ,x/^ +/s/// > ,x/ +$/s/// > ,x/ +/s// / > ,x/^$\n/d > ,x/=E2=80=98=E2=80=98|=E2=80=99=E2=80=99/s//"/ > ,x/=E2=80=9C|=E2=80=9D/s//"/ > ,x/=E2=80=98|=E2=80=99/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-Mcecc2= 4b77fbe2df7b744e4f9 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription --000000000000f75d1d05c79ebecb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
There are many things here that feel wrong or = at least inelegant, starting with the first character. Surely you mean a co= mma not a period. You are also inconsistent: sometimes you use x to find th= e 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, p= eople could offer solutions. I assure you sam can do this; it's far mor= e 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.

<= div>-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 remov= es 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:
<= pre style=3D"margin:7px 0px;border-radius:3px;border:1px solid rgb(204,204,= 204);padding:7px 10px;background:rgb(246,246,246);font-family:menlo,consola= s,monospace;font-size:90%;white-space:pre-wrap">.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&n= bsp;options Permalink = --000000000000f75d1d05c79ebecb--