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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2571 invoked from network); 6 Aug 2021 00:22:09 -0000 Received: from tb-ob20.topicbox.com (173.228.157.66) by inbox.vuxu.org with ESMTPUTF8; 6 Aug 2021 00:22:09 -0000 Received: from tb-mx1.topicbox.com (tb-mx1.nyi.icgroup.com [10.90.30.61]) by tb-ob20.topicbox.com (Postfix) with ESMTP id 941DC1D44D for ; Thu, 5 Aug 2021 20:22:06 -0400 (EDT) (envelope-from bounce.mM6657add7fd6d31ba8f447d79.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx1.topicbox.com (Postfix, from userid 1132) id 352A830F69F2; Thu, 5 Aug 2021 20:22:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h=to:subject :message-id:references:in-reply-to:date:mime-version :content-type:content-transfer-encoding:from:list-help:list-id :list-post:list-subscribe:reply-to:list-unsubscribe; s=dkim-1; bh=1Q3v7HZrChSneg2I5UcD70crTS9EH86QW4df+vxlMZE=; b=NIZgfxhKzmzz W2JAY8ohv44wFxcaDFamkHe/UgTL+v0FYrnd4MHLdhU2LTxfguIVmtna6bJHaWrN eAbX73miJJeVlAo1KBBA2zUJSH87Lblvm5qZ/EaKmH6VObOBiN7UAiC4yCBAuyPC 5XsFB8Fsr2YYy9YwG0hOv/oRPqEdNio= To: 9fans <9fans@9fans.net> Subject: Re: [9fans] A few more questions about sam Message-Id: <16282093200.FCec64.804761@composer.9fans.topicbox.com> References: <674DE2214EA337146FCDA7D4674815E7@prosimetrum.com> In-Reply-To: <674DE2214EA337146FCDA7D4674815E7@prosimetrum.com> Date: Thu, 5 Aug 2021 20:22:00 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="16282093201.BfEF.804761" Content-Transfer-Encoding: 7bit Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 5110ebaa-f64c-11eb-8977-65f21f2d11b0 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UMzEwN2NkM2JjNTM2ZGM2My1NNjY1N2FkZDdmZDZkMzFiYThmNDQ3?= =?UTF-8?B?ZDc5Pg==?= From: "fwrm via 9fans" <9fans@9fans.net> List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:M6657add7fd6d31ba8f447d79:1:1nHNzI-ILld-Tqz26jydba1WnRU1g6vK0ZEnluriigo --16282093201.BfEF.804761 Date: Thu, 5 Aug 2021 20:22:00 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 4) In ed/awk/grep/etc... regexp is used to "select" *the lines containing i= t* and do stuff, in sam however it's used to describe the shape of string(s= ) themselves you want to "select" (with x and y commands). It doesn't have = the concept of a line. Your selection can be less than a line, or you can s= elect multiple strings that happen to be in different lines. Or multiple li= nes. For example, consider this string: hello "test" bye "hello" again The command ,x/".+"/ would select every string that begins with a double qu= ote, has one character or more after that, and ends with a double quote. If= we wanted to select only the characters inside double quotes, we could rej= ect the double quote character by adding the command y/"/ to the previous o= ne. Or we can also only select the quotes by adding x/"/ instead, if we wan= ted to change double quotes (that surround one or more characters) to singl= e quotes we could do: ,x/".+"/ x/"/ c/'/ or to capitalize all letters insid= e quotes (with the unix tool tr(1)) we could do: ,x/".+"/ y/"/ | tr [:lower= :] [:upper:] You can do interesting things with x and y when you combine them with the c= onditionals: g and v. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/T3107cd3bc536dc63-M6657a= dd7fd6d31ba8f447d79 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription --16282093201.BfEF.804761 Date: Thu, 5 Aug 2021 20:22:00 -0400 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
4) In ed/awk/grep/etc... regexp is used to &qu= ot;select" *the lines containing it* and do stuff, in sam however it&#= 39;s used to describe the shape of string(s) themselves you want to "s= elect" (with x and y commands). It doesn't have the concept of a l= ine. Your selection can be less than a line, or you can select multiple str= ings that happen to be in different lines. Or multiple lines.

For example, consider this string:
hell= o "test" bye
"hello" again
<= div>
The command ,x/".+"/ would select every stri= ng that begins with a double quote, has one character or more after that, a= nd ends with a double quote. If we wanted to select only the characters ins= ide double quotes, we could reject the double quote character by adding the= command y/"/ to the previous one. Or we can also only select the quot= es by adding x/"/ instead, if we wanted to change double quotes (that = surround one or more characters) to single quotes we could do: ,x/".+&= quot;/ x/"/ c/'/ or to capitalize all letters inside quotes (with = the unix tool tr(1)) we could do: ,x/".+"/ y/"/ | tr [:lower= :] [:upper:]

You can do interesting things= with x and y when you combine them with the conditionals: g and v.
= --16282093201.BfEF.804761--