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: Problem with Cygwin 1.7.17 + Bash and Grep...


>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@D630-Vmorales ~]# for i in `cat file-a.txt`; do echo $i;
>grep $i file-b.txt; done
>alpha
>beta
>charlie
>delta
>echo
>
>[vmorales@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


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