delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/10/07:17:20

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Reply-To: <Jan DOT Schormann AT BrainLAB DOT com>
From: "Jan Schormann" <Jan DOT Schormann AT BrainLAB DOT com>
To: <cygwin AT cygwin DOT com>
Subject: Now I see - was RE: sed-4.1.2-1: backslash in 'i' and 'a' changed?
Date: Fri, 10 Sep 2004 13:17:09 +0200
Message-ID: <KCEOLMMHICICJKHPFOALGEIPCIAA.Jan.Schormann@BrainLAB.com>
MIME-Version: 1.0
In-Reply-To: <20040910102754.GA2559@cygbert.vinschen.de>
X-OriginalArrivalTime: 10 Sep 2004 11:17:10.0085 (UTC) FILETIME=[B6DFB750:01C49727]
X-Spam-Status: No, hits=-103.0 required=6.0 tests=BAYES_20,IN_REP_TO,MSGID_GOOD_EXCHANGE,RCVD_IN_ORBS, USER_IN_WHITELIST version=2.55
X-Spam-Level:
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
X-IsSubscribed: yes

Hi,

sorry, by now even I noticed that this is OT because it
depends entirely on upstream. Then again, I found out
where I was misunderstanding the documentation, and I'd
like to share:

I always thought that the '\' after 'a' was denoting a
continuation line and could be left out if you put all
the text in the same line, which of course I'm always
tempted to do when I provide expressions using the '-e'
command line switch.

Thanks for the enlightenment,
	Jan.

.. Full story:

> From `info sed':
> 
>   `a\'
>   `TEXT'
>        [...]
>        Escape sequences in TEXT are processed, so you 
>        should use `\\' in TEXT to print a single backslash.

Yeah well, so '\\x' should print a single backslash and an 'x',
but it doesn't print a backslash at all ... Oh I see, *if* it's
the first thing in the argument, where sed 4.1.2 reads it
as '\' + '\x' in these examples:

 $ echo | sed -e 'ix\\x'
 x\x

 $ echo | sed -e 'i\\x'
 x

While 3 bs produce the (by me) desired result in both versions:

 $ echo | sed -e 'i\\\x'
 x

OK, can live with that ;-)



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019