Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Dave Korn" To: Subject: RE: Grep and matching end of line (anchoring) Date: Fri, 19 Nov 2004 19:05:33 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: Message-ID: X-OriginalArrivalTime: 19 Nov 2004 19:05:33.0671 (UTC) FILETIME=[BED51F70:01C4CE6A] > -----Original Message----- > From: cygwin-owner On Behalf Of Buchbinder, Barry (NIH/NIAID) > Sent: 19 November 2004 18:53 > >> This should work whether or not one is on a text mount or for > >> the file has DOS or Unix line endings: > >> > >> cat files.txt | grep -E '\.h^M?$' > > > > Always test before posting. Even a one liner. That doesn't work, > > or at least NFM: > I tested by cat-ing a batch file and it worked for me. I did > not put the > two character "^" and "M" in. In bash I put a control-M by hitting > control-V and then . The console showed the two > character ^M and I > just copied the console screen to the email. Wow, that's interesting, and very very useful. I'd never heard of lnext until now! Of course if you press ctrl+M, it sends the line; same if you press ALT+013. > I used the word "should" because I did not test in all > combinations of text > and binary mounts and line endings. I'm sorry if that choice > of word was too ambiguous or subtle. No, that word had nothing to do with my misunderstanding. It was entirely because of this bit: > I did not think that grep understood ^M -- I assumed that the > readers in > this list would understand it. Personally I've never seen > the two character > ^M used for inputting a \r. ^ notation is the standard used by stty for describing control chars. I'm not sure what other apps may or may not speak it, but that's why I thought that was what you were attempting. > It has, in my experience, always > been used to > indicate a \r in output or when viewing a file in a hex > editor so I thought > that it would be understood. I apologize for not being explicit. Apologies aren't necessary, but explanations are wonderful things! cheers, DaveK -- Can't think of a witty .sigline today.... -- 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/