delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/04/05/14:24:51

X-Spam-Check-By: sourceware.org
Message-Id: <200604051824.k35IOLTm023813@tigris.pounder.sol.net>
To: cygwin AT cygwin DOT com
From: cygwin AT trodman DOT com (Tom Rodman)
Reply-to: cygwin AT cygwin DOT com
X-note: From should match addr u signed up w/, else post will not show for > 90 min (3/2005)
Subject: new gawk & sed in pipes (sed now acts binary; awk now does dos2unix)
Date: Wed, 05 Apr 2006 13:24:21 -0500
X-IsSubscribed: yes
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

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/

- Raw text -


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