delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/02/05/09:49:56

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=AWL,BAYES_00,KHOP_DYNAMIC,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
From: "Gates, Roger" <Roger DOT Gates AT goodrich DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: RE: Problem with Cygwin 1.7.17 + Bash and Grep...
Date: Tue, 5 Feb 2013 14:49:13 +0000
Message-ID: <9E285A913B6C6B4797EBAB83675F80D9058F95@NHC0EX52.goodrich.root.local>
References: <CAAoqyza3HaVrXFt+mAJWzjH=hjmz-0H0HtCCwK_1_qk4HoT=sw AT mail DOT gmail DOT com>
In-Reply-To: <CAAoqyza3HaVrXFt+mAJWzjH=hjmz-0H0HtCCwK_1_qk4HoT=sw@mail.gmail.com>
MIME-Version: 1.0
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1211240000 definitions=main-1302050086
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r15Eno9u027547

>I'm essentially trying to take the contents of one file, and use it as
>input for a grep command against another file, but I do not get any
>results, even though I know the 2nd file contains a match.  In the
>one-liner below, I include an "echo" to confirm the output is in the
>variable that should be used with the grep command.
>
>[vmorales AT D630-Vmorales ~]# for i in `cat file-a.txt`; do echo $i;
>grep $i file-b.txt; done
>alpha
>beta
>charlie
>delta
>echo
>
>[vmorales AT D630-Vmorales ~]# grep charlie file-b.txt
>charlie,13

File-a.txt must be in DOS format. Try this. 

for i in `cat file-a.txt | d2u`; do echo $i;
grep $i file-b.txt; done
alpha
beta
charlie
charlie,13
delta
echo

Roger



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


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