delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/07/12/09:35:55

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Chuck <skilover AT bluebottle DOT com>
Subject: Re: grep and words
Date: Wed, 12 Jul 2006 09:34:37 -0400
Lines: 16
Message-ID: <e92tpd$jfo$1@sea.gmane.org>
References: <5284068 DOT post AT talk DOT nabble DOT com>
Mime-Version: 1.0
User-Agent: Thunderbird 1.5.0.4 (Windows/20060516)
In-Reply-To: <5284068.post@talk.nabble.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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
> Thanks for all info
> Best Regards, Guy Przytula

Ditto that this is not a cygwin question per say.

I would use awk.

awk '$2 = "yyyy"' filename


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