* sed end of line
@ 2019-03-15 9:51 Timo Maier
2019-03-15 10:02 ` Vlado
2019-03-15 10:03 ` Soegtrop, Michael
0 siblings, 2 replies; 6+ messages in thread
From: Timo Maier @ 2019-03-15 9:51 UTC (permalink / raw)
To: cygwin
Hello, I have a problem with sed.
Ubuntu:
timo@serv6:~# echo "CHANGE MASTER;" | sed '/^CHANGE MASTER.*/ s/.$/ for channel "de";/'
CHANGE MASTER for channel "de";
Works as expected.
Windows:
C:\> echo CHANGE MASTER;| sed.exe '/^CHANGE MASTER.*/ s/.$/ for channel "de";/'
CHANGE MASTER; for channel "de";
last character ";" is not being deleted
now with a second "." before "$" (to delete last 2 characters):
C:\> echo CHANGE MASTER;| sed.exe '/^CHANGE MASTER.*/ s/..$/ for channel "de";/'
CHANGE MASTER for channel "de";
This is how I want it.
Why do I need a second "." in the cygwin sed?
sed.exe --version
/usr/bin/sed (GNU sed) 4.4
Packaged by Cygwin (4.4-1)
--
Timo
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sed end of line
2019-03-15 9:51 sed end of line Timo Maier
@ 2019-03-15 10:02 ` Vlado
2019-03-15 10:03 ` Soegtrop, Michael
1 sibling, 0 replies; 6+ messages in thread
From: Vlado @ 2019-03-15 10:02 UTC (permalink / raw)
To: cygwin
On 15. 3. 2019 10:51, Timo Maier wrote:
> Why do I need a second "." in the cygwin sed?
>
Hi Timo.
The difference is in echo.
$ /bin/echo "Hey" | /usr/bin/hexdump -C
00000000 48 65 79 0a |Hey.|
00000004
C:\>echo Hey| c:\cygwin\bin\hexdump -C
00000000 48 65 79 0d 0a |Hey..|
00000005
Vlado
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: sed end of line
2019-03-15 9:51 sed end of line Timo Maier
2019-03-15 10:02 ` Vlado
@ 2019-03-15 10:03 ` Soegtrop, Michael
2019-03-15 10:33 ` Timo Maier
2019-03-16 2:59 ` Brian Inglis
1 sibling, 2 replies; 6+ messages in thread
From: Soegtrop, Michael @ 2019-03-15 10:03 UTC (permalink / raw)
To: Timo Maier, cygwin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 868 bytes --]
Dear Timo,
you are mixing a DOS echo which will produce a \r\n line ending with a Cygwin sed which expects \n line endings. The second . matches the \r.
Either work in bash and use Cygwin echo or use a MinGW compile of sed or strip the \r e.g. with tr or maybe match it more explicitly with a \r.
Best regards,
Michael
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, , Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
\0ТÒÐÐ¥\a&ö&ÆVÒ\a&W\x06÷'G3¢\x02\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒ÷\a&ö&ÆV×2æFÖÀФd\x15\x13¢\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒöf\x17\x12ðФFö7VÖVçF\x17Föã¢\x02\x02\x02\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒöFö72æFÖÀÐ¥Vç7V'67&&R\x06æfó¢\x02\x02\x02\x02\x02\x06GG\x03¢òö7wvâæ6öÒöÖÂò7Vç7V'67&&R×6×\x06ÆPÐ Ð
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sed end of line
2019-03-15 10:03 ` Soegtrop, Michael
@ 2019-03-15 10:33 ` Timo Maier
2019-03-16 2:59 ` Brian Inglis
1 sibling, 0 replies; 6+ messages in thread
From: Timo Maier @ 2019-03-15 10:33 UTC (permalink / raw)
To: cygwin
Hi Michael.
> you are mixing a DOS echo which will produce a \r\n line ending with a Cygwin sed which expects \n line endings.
I already thought it's something about EOL, just wanted to make sure if this is not a bug. Thanks.
--
Timo
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sed end of line
2019-03-15 10:03 ` Soegtrop, Michael
2019-03-15 10:33 ` Timo Maier
@ 2019-03-16 2:59 ` Brian Inglis
2019-03-16 14:49 ` L A Walsh
1 sibling, 1 reply; 6+ messages in thread
From: Brian Inglis @ 2019-03-16 2:59 UTC (permalink / raw)
To: cygwin
On 2019-03-15 04:03, Soegtrop, Michael wrote:
> you are mixing a DOS echo which will produce a \r\n line ending with a
> Cygwin sed which expects \n line endings. The second . matches the \r.
> Either work in bash and use Cygwin echo or use a MinGW compile of sed or
> strip the \r e.g. with tr or maybe match it more explicitly with a \r.
Or use Cygwin printf "%s\n" "Hey" to avoid differing echo output.
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sed end of line
2019-03-16 2:59 ` Brian Inglis
@ 2019-03-16 14:49 ` L A Walsh
0 siblings, 0 replies; 6+ messages in thread
From: L A Walsh @ 2019-03-16 14:49 UTC (permalink / raw)
To: Brian.Inglis, cygwin
On 3/15/2019 7:59 PM, Brian Inglis wrote:
> On 2019-03-15 04:03, Soegtrop, Michael wrote:
>
>> you are mixing a DOS echo which will produce a \r\n line ending with a
>> Cygwin sed which expects \n line endings. The second . matches the \r.
>> Either work in bash and use Cygwin echo or use a MinGW compile of sed or
>> strip the \r e.g. with tr or maybe match it more explicitly with a \r.
>>
>
> Or use Cygwin printf "%s\n" "Hey" to avoid differing echo output.
>
Or when in cygwin, make sure your cygwin paths are first.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-03-16 14:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 9:51 sed end of line Timo Maier
2019-03-15 10:02 ` Vlado
2019-03-15 10:03 ` Soegtrop, Michael
2019-03-15 10:33 ` Timo Maier
2019-03-16 2:59 ` Brian Inglis
2019-03-16 14:49 ` L A Walsh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).