This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Now I see - was RE: sed-4.1.2-1: backslash in 'i' and 'a' changed?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]