Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
From: mitch gart <mgart@kronos.com>
Subject:  sed and searches for $
Date: Tue, 5 Apr 2005 20:02:02 +0000 (UTC)
Lines: 23
Message-ID:  <loom.20050405T215243-900@post.gmane.org>
Mime-Version:  1.0
Content-Type:  text/plain; charset=us-ascii
Content-Transfer-Encoding:  7bit
X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: main.gmane.org
User-Agent: Loom/3.14 (http://gmane.org/)
X-Loom-IP: 158.228.56.15 (Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2)
X-IsSubscribed: yes

It seems like sed works differently when searching for end-of-line ($)
depending if it's launched from a DOS prompt or from inside a shell
prompt.  For example if I have a file named junk which contains 1 line

  hello\

( \ is the last character of the line.)  The command

  sed -n  -e /\\$/= junk

prints

  1

when launched from DOS, and prints nothing when launched from the shell.

I've been pretty mystefied by this but I'm guessing the reason has something
to do with the difference between lines terminated by \r\n (DOS) and \n
(Unix).

Anyway what I want is to write a sed script that recognizes both kinds
of line separators, and runs correctly from inside the shell.  Can somebody 
tell me how?   Thanks.


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

