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]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]