X-Spam-Check-By: sourceware.org From: "Dave Korn" To: References: <019001c77617$8e0eabc0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> Subject: RE: grep and exact matches help.. Date: Tue, 3 Apr 2007 19:30:36 +0100 Message-ID: <019601c7761e$2c2531c0$2e08a8c0@CAM.ARTIMI.COM> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On 03 April 2007 19:01, Kevin Markle wrote: > In this search I want to get winops only not winops and winops-hq > > kmarkle AT backup /cygdrive/e/wsus/group_1a_DEV > $ ls -al | grep winops > -rwx------+ 1 Administrators ???????? 1079474 Apr 2 19:32 > winops-hq_WINDOWSUpdate.log > -rwx------+ 1 Administrators ???????? 18993 Apr 3 13:02 > winops-hq_asr.log > -rwx------+ 1 Administrators ???????? 1242842 Apr 3 06:01 > winops_WINDOWSUpdate.log > -rwx------+ 1 Administrators ???????? 18580 Apr 3 13:02 > winops_asr.log Ummm, you need to be more precise than that. If you ask for an "exact match", which to me means "winops not followed by anything at all" from that search, you'll get nothing because there isn't a file called "winops". It seems to me that what you want is not an exact match after all; what you want is "winops, and it may be followed by some things, but not by some other things". You'll need to write a regular expression that allows those first "some things" while denying the "some other things". [BTW we're getting off-topic here, since this is really a generic 'grep' question and nothing specific to cygwin at all.] BTW2, I assume we're still talking about your script from before. Seriously, use "ls -1" rather than "ls -l" (that is, use a one instead of an L), because then you get /just/ the filenames, one per line, and won't have to worry about parsing the name out from amongst all those permission flags and datestamps. 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/