RE: Problem with Cygwin 1.7.17 + Bash and Grep...

2013-02-04 Thread Nellis, Kenneth
-Original Message-
From: Vladimir Morales 

Tried google and found similar, but not the exact issue I'm seeing.
I'm running Windows 7 and trying to run a simple bash one-liner using
grep:

[vmorales@D630-Vmorales ~]# uname -a
CYGWIN_NT-6.1-WOW64 D630-Vmorales 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin


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


This is pretty straight-forward and can't think of what I may be
missing here.  Any suggestions would be appreciated.

Vlad
-End Original Message-

Maybe file-a.txt contains CRLF line endings?
--Ken Nellis

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



Re: Problem with Cygwin 1.7.17 + Bash and Grep...

2013-02-04 Thread Vladimir Morales
So silly.  Used pspad to reformat as UNIX(LF) and works as expected now.

Thanks Ken.

On Mon, Feb 4, 2013 at 4:06 PM, Nellis, Kenneth
 wrote:
> -Original Message-
> From: Vladimir Morales
>
> Tried google and found similar, but not the exact issue I'm seeing.
> I'm running Windows 7 and trying to run a simple bash one-liner using
> grep:
>
> [vmorales@D630-Vmorales ~]# uname -a
> CYGWIN_NT-6.1-WOW64 D630-Vmorales 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 
> Cygwin
>
>
> 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
>
>
> This is pretty straight-forward and can't think of what I may be
> missing here.  Any suggestions would be appreciated.
>
> Vlad
> -End Original Message-
>
> Maybe file-a.txt contains CRLF line endings?
> --Ken Nellis
>
> --
> 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
>

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



RE: Problem with Cygwin 1.7.17 + Bash and Grep...

2013-02-05 Thread Gates, Roger

>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



Re: Problem with Cygwin 1.7.17 + Bash and Grep...

2013-02-05 Thread Alan Thompson
Never heard of pspad, but I use Cygwin's dos2unix all the time for
this kind of thing.
Alan Thompson

On Tue, Feb 5, 2013 at 6:49 AM, Gates, Roger  wrote:
>
>
> >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
>

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