delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/07/12/03:41:07

X-Spam-Check-By: sourceware.org
Message-ID: <44B4A783.17BFB50E@dessent.net>
Date: Wed, 12 Jul 2006 00:40:51 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: grep and words
References: <5284068 DOT post AT talk DOT nabble DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

prz wrote:

> another question from newbie ..
> is it possible with grep to select only the rows where the second word
> applies, because the pattern can occur at different places like :
> row 1 : xxxx yyyy zzz
> row 2 : yyyy xxxx zzz
> I need only the row where word 2 = yyyy
> grep yyyy would also return row 2

This is not specific to Cygwin in any way, so it's kind of off-topic for
this mailing list.  I suggest you google for regular expression
tutorials, as this is the basis for how grep operates.

If it were me I would use grep -P "^\S+\s+yyyy" but there are numerous
ways to accomplish this and it would depend on the specifics of the data
that you're trying to match.

Brian

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019