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=-6.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31288 invoked from network); 14 Oct 2022 15:45:04 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Oct 2022 15:45:04 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1665762304; b=ennFo2dywK4swjRbhY5K3Vaw8/VgtNnCJ3ydTN8H1diim79TDb+ftfiQO5UjTcYIJ+ALDZoOYa Y3FLRJZBAaDYed7gb2anK0f7kGGrxXuqN+ZSj2R7cMMb9wB55IHOTqo9GEdDcGgWO+Z4XSmv+u AIWXD8i79jgr4387ygOfTSb6VkS/ljO4CuNtBrIK4sXuLxBlJmkx0DRBIBJ+WqPLhDzmcPrZ3r ZFyQ66Qyo2KsQXLpAH3xlPAGKyIZYEbOVBoe1k9Dnc+lyWtfvk7F2QRwRHsKXEDDo07MD00zmA MhfIP5y2UECphOFfgSNcl7pZSmqx4j6+cFs6car4IrqC5g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1665762304; bh=1zBVFNGwxKBY5w21Hbd/kvE3utCXF7xfnBJsI9V9Wxg=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=qfUzSLyHoU8qEPKSC4izFxu3DNfOE8hfx3vz0Pc0UbbI9SndA0nQ3hri8JMeRoJOKQaw5I4Mnb NvvD6hA9CcrGXDtpP5v/1HOjklObGvsQr6q/6mHYQ9US6ltSnGYH6BqAeQK2MgfOC5h0kqEO6n +srymB6fVjLJ0YUPWZSZ9aUSOAbS76QpXFtKiYc6K7pONk/KW6CTx9EFar3QsUM2mn5U4qxjXg awERTkPn8guyZuG9ZJ+4ByiTYvrQYxUZe0yg6s+1cpDxRuhBVa5NcaP+7hc9F4BYRg3MsseNws mMv5Mg7X5fbRDvPM+rYoxY8Q2CvnTz84+lU9C6SoK47mLA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-transfer-encoding: Content-type:In-reply-to:From:References:To:Subject:MIME-version:Date: Message-id:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=KCxKCTziXnWeSmpAIIr/nh0eCJiqgHhja5+/tz9H17M=; b=Y1iJBbyeaQULW2U/w00JH/eZWV A0TRhQks1ipBypiEVd49yySjhHP7Gmybig7MUeExK5cwMGJTA/hRncyuebLPCQXdROmjw5nOfwk1j J/fiWikaB9Ph7FaNAs/PdBYaehhCpiSMMeHVnGG/ElbM9k6w2A8XiYFF91E7TmfQW6/7u6XptskbT tBubsXItvVh2/RAeqXSUNX6AhlVOkvArT3s1RYayymAQQWeN0AcV8M3wIA5gnN/wMkcSLcvoF/RRl TqfOtGJAndkGHJzS6q8zJx8DDYCTqpujyfDrhal0sA+QWzm4v4WpmnAyyhbNHnVU+ij0dUE5Vbplh 9jBTkxgw==; Received: by zero.zsh.org with local id 1ojMrv-000L2R-OI; Fri, 14 Oct 2022 15:45:03 +0000 Authentication-Results: zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none Received: from mta04.eastlink.ca ([24.224.136.10]:35638) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1ojMr5-000KL6-0L; Fri, 14 Oct 2022 15:44:13 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta04.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RJR00NS010M5RF0@mta04.eastlink.ca> for zsh-users@zsh.org; Fri, 14 Oct 2022 12:44:09 -0300 (ADT) Received: from [192.168.0.4] ([24.207.18.108]) by Eastlink with ESMTPSA id jMr2oT4LWlmAkjMr3oqpxc; Fri, 14 Oct 2022 12:44:09 -0300 X-Authority-Analysis: v=2.4 cv=Y/M9DjSN c=1 sm=1 tr=0 ts=634983c9 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=QbeVWIA7iuOzGnGRvKoA:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekvddgleegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepiefhfedvffelgeejfeejheejveffhfffudefuedufeevffdtteduiefhveevieefnecukfhppedvgedrvddtjedrudekrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrddukedruddtkedphhgvlhhopegludelvddrudeikedrtddrgegnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Message-id: Date: Fri, 14 Oct 2022 08:44:08 -0700 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: line continuation with sed Content-language: en-US To: zsh-users@zsh.org References: <9184bbff-9e68-7b02-2595-3474b016dfff@eastlink.ca> From: Ray Andrews In-reply-to: Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 7bit X-Seq: 28206 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Thanks for the replies all: $ ls filename\ ending\ with\ a\ space\ Ok, so it's an overload of the backslash, which might mean an escaped character, or might indicate line continuation. I think in my example there'd be no difference but I understand your example where ... mind, people who end a filename with a space aren't fit to live ... but linux isn't going to stop you from doing it, so that case must be accommodated. So then *only* 'backslash-newline' is a line continuation and any other variant leaves the backslash as an escape, yes? Playing with it a bit more, sending the command to history and then recalling it I see the defect: $ junk="now is the time for all good men to come to the aid of the party" ... now run this script: aa="print -l ${(q)junk} | sed \ -nre s/all/most/p \ -e s/men/persons/p \ -e s/aid/assistance/p" print -rS "$aa" eval $aa ... and get: $ . test for most good men for most good persons to come to the assistance ... recalling from history it works fine, but if I modify the '$aa' command with the 'backslash-space-newline' the recalled command looks like this: print -l now\ is\ the\ time$'\n'for\ all\ good\ men$'\n'to\ come\ to\ the\ aid$'\n'of\ the\ party | sed -nre s/all/most/p -e s/men/persons/p \ -e s/aid/assistance/p ... so the bleeding backslash is literal ... I guess that's because the space does not 'escape'? ... but I thought you could put a backslash before any character? Anyway we get a literal backslash and then a literal newline and naturally things go sour. All this to accommodate servants of the Evil One who would end a filename with a space! Seriously, I get it, thanks guys. I don't like it, but i can see what gets feed to sed, and why it goes wrong, invisibly. Peter: You can configure a number of editors to show this up. In emacs, for example, I use: (setq-default show-trailing-whitespace t) ... I know it, but after my Debian upgrade whereas my editor used to show a nice little 'return' character/icon, it now shows a 'LF" backlit in white that's so annoying I turned it off :( ... so I'm a victim of that mistake. I'd normally remove trailing spaces just to be tidy, nevermind disasters like the above.