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]

new gawk & sed in pipes (sed now acts binary; awk now does dos2unix)


The latest versions of gawk and sed appear to have changed how they
process DOS text STDIN.  This change in behavior has broken some of 
our scripts.  Is this change in behavior by design?  Can we revert back
to the old design?

Pls see test cases below.

--
thanks,
Tom Rodman

# -------------------------------------------------------------------- 
# Normal behavior for many past revs of cywgin's gawk and sed:
#   o sed is *not* binary in pipes (it converts DOS text to UNIX)
#   o awk is binary in pipes (it leaves line terminators alone)
#
#   NOTE that "printf" test below sends 1 DOS line of text (\r\n), and 1 UNIX line
# -------------------------------------------------------------------- 

  ~ $ date;uname -a
  Wed Apr  5 12:43:46 CDT 2006
  CYGWIN_NT-5.2 OurSrvr063 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin
  ~ $ cygcheck -c|egrep 'gawk|sed'
  gawk                 3.1.5-2            OK
  sed                  4.1.4-1            OK
  ~ $ printf "hi\r\nho\n"|eval sed '/foo/d'|od -c
  0000000   h   i  \n   h   o  \n
            h   i  \n   h   o  \n
  0000006
  ~ $ printf "hi\r\nho\n"|eval awk '{print}'|od -c
  0000000   h   i  \r  \n   h   o  \n
            h   i  \r  \n   h   o  \n
  0000007

# -------------------------------------------------------------------- 
# Problem behavior for new gawk and sed
#   o sed is now binary in pipes (it leaves line terminators alone)
#   o awk is *not* binary in pipes (it converts DOS text to UNIX)
# -------------------------------------------------------------------- 
  ~ $ date;uname -a
  Wed Apr  5 12:53:56 CDT 2006
  CYGWIN_NT-5.0 OurServer108 1.5.20s(0.155/4/2) 20060329 23:02:10 i686 Cygwin
  ~ $ cygcheck -c|egrep 'gawk|sed'
  gawk                 3.1.5-4            OK
  sed                  4.1.5-1            OK
  ~ $ printf "hi\r\nho\n"|eval sed '/foo/d'|od -c
  0000000   h   i  \r  \n   h   o  \n
  0000007
  ~ $ printf "hi\r\nho\n"|eval awk '{print}'|od -c
  0000000   h   i  \n   h   o  \n
  0000006


--
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]