From 9fans.bounce.topicbox.com!bounce.mMcecc24b77fbe2df7b744e4f9.r9e00e022-a139-11eb-b835-09bb272d11b0 Wed Jul 21 05:27:19 -0400 2021 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=1626859632; bh=kDgYA6OXwvyKv7BP tP+Fy7VsH4LodcCcXK7F9IjtH1w=; b=bFLQD4QUH29qqQcVTay054Bqec0kAwZT BQtj8jP6EEnpjrMaEkMgp2Bi3QhIemzRJdCwWIAIogQXadRmwAvsdfxmrZvSPBUI bEREx4/lTwTTWWtjP8QSYcxjdzj5CoBLVWAgWROTN2kZRTdCnWDci65MNJ+BMfJR /Lc9808pXkw= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1626859632; b=TPLLDpYz0b4G/WEqK2pA+flxasrCKBcW5A6VVbrG54VPmPX7I7 xxCM+jqelcyuOjt80vrJRl5o0yxrgNcksrX2qp905Ujd3F+ttvCjMbbgEqVvU/vr cP+1hx6yatKyB0a/tRw9aeG02Zron792Gl67lowbTITQ8DL861sqqbfFQ= 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) 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 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 From: Rob Pike Date: Wed, 21 Jul 2021 19:24:55 +1000 Subject: Re: [9fans] Help with a sam cleanup script To: 9fans <9fans@9fans.net> Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 8d7e8e56-ea05-11eb-91cc-f7a26a9b87b9 Archived-At: Reply-To: 9fans <9fans@9fans.net> Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:9e00e022-a139-11eb-b835-09bb272d11b0:Mcecc24b77fbe2df7b744e4f9:1:X19j8_ngxvW5ycMEPMaw0sQdOTsN-O8Iqb64bqYI6qA 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