|
From: | Mike Miller |
Subject: | Re: finding .m files using 'locate' |
Date: | Tue, 19 Jul 2005 08:33:31 -0500 (CDT) |
On Mon, 18 Jul 2005, Mike Miller wrote:
On Mon, 18 Jul 2005, Przemek Klosowski wrote:there's a mistake in your regexp: s#(^.*)/[^/]+.m#$1#g the dot before the 'm' should be escaped (the result is OK, but it is the kind of problems that trip up even seasoned regexp users).You are right because I'm sure I mean to put a backslash in there, but I'm not sure that it does anything in this context (after "egrep '\.m$'"). In fact, I think this would work (dropping the ".m")...s#(^.*)/[^/]+#$1#g ...because the first '*' is greedy so it takes up the full path.
Darn it -- I meant to correct that before I sent it. When it is written that way (with no 'm') it deletes the newlines. The 'm' is needed, but the '.' can be deleted. I had it right in this line near the end of my message:
locate "*.m" | perl -pe 's#(^.*)/[^/]+m#$1#' | sort | uniq
Mike ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------
[Prev in Thread] | Current Thread | [Next in Thread] |