This is the mail archive of the
cygwin
mailing list for the Cygwin project.
sed and searches for $
- From: mitch gart <mgart at kronos dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 5 Apr 2005 20:02:02 +0000 (UTC)
- Subject: sed and searches for $
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/