Re: Shell prg for finding occurrance of a string in FILE1 in other file FILE2
From: Anil (anilby_at_gmail.com)
Date: 11/04/04
- Next message: Robert Katz: "Re: Shell prg for finding occurrance of a string in FILE1 in other file FILE2"
- Previous message: kumar.sandy_at_gmail.com: "how to make rsh (unix utility) source my .profile (korn shell)"
- In reply to: Stephane CHAZELAS: "Re: Shell prg for finding occurrance of a string in FILE1 in other file FILE2"
- Next in thread: Robert Katz: "Re: Shell prg for finding occurrance of a string in FILE1 in other file FILE2"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 3 Nov 2004 23:06:35 -0800
Stephane CHAZELAS <this.address@is.invalid> wrote in message news:<slrncoh7hg.m8.stephane.chazelas@spam.is.invalid>...
> 2004-11-2, 22:33(-08), Anil:
> > Hi,
> >
> > I need a unix bash shell program to accomplish the below task.
> > File1 has some strings one below the other.
> > abcd
> > efgh
> > ijkl
> > mnop
> > qrst
> > uvwx
> > yzab
> >
> > File2 has some strings one below the other.
> > abcd
> > efgh
> > ijkl
> > mnop
> > qrst
> > uvwx
> > yzab
> > abcd
> > efgh
> > ijkl
> > mnop
> > qrst
> > uvwx
> > yzab
> >
> > I need to find whether each strings in File1 are present in File2 or not.
> [...]
>
> Try:
>
> comm -2 -3 <(sort File1) <(sort File2)
>
> grep -xFf File1 File2
>
> awk 'BEGIN{while ((getline < File1) > 0) a[$0]=""} $0 in a}' < File2
>
> (untested)
Thanks for teh responses.
- Next message: Robert Katz: "Re: Shell prg for finding occurrance of a string in FILE1 in other file FILE2"
- Previous message: kumar.sandy_at_gmail.com: "how to make rsh (unix utility) source my .profile (korn shell)"
- In reply to: Stephane CHAZELAS: "Re: Shell prg for finding occurrance of a string in FILE1 in other file FILE2"
- Next in thread: Robert Katz: "Re: Shell prg for finding occurrance of a string in FILE1 in other file FILE2"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|