sed end of line

Timo Maier tam@diotec.com
Fri Mar 15 09:51:00 GMT 2019


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



More information about the Cygwin mailing list