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]

RE: grep and exact matches help..


On 03 April 2007 19:01, Kevin Markle wrote:

> In this search I want to get winops only not winops and winops-hq
> 
> kmarkle@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/


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