On Fri, 15 Sep 2017 07:03:04 -0700 (PDT) [email protected] wrote: > thank you > I have tried comm it is fast. the only thing is that I am looking to > one side difference. > I mean if file2 contains word not in file1 that will not be needed to > output. only if words in file1 but not in file2. > so I solved it by this bash script > > for n in `cat file1`; do > A='notfound' > A=`awk -v word=$n -v f="A" -F ' ' '{if($1==word){print > "found"}}' file2` > if [ $A = 'notfound' ] ;then > echo $n >> f2 > fi > > done > > It is faster than grep but still any faster way is appriciated. > > Thank you so much for introducing comm, I may use comm in other > problems > > > On Friday, September 15, 2017 at 9:34:14 AM UTC-4, Jim Keenan wrote: > > > > On 09/15/2017 08:13 AM, [email protected] <javascript:> wrote: > > > Hi, > > > I have two files(file 1 file2), each contains one word in ecah > > > line. I am trying to get the words in file2 that are not in > > > file1. saving result in file3 > > > I need equivelant awk command to the following grep > > > grep -F -x -v -f file2 file1 > file3 > > > grep takes time and is beeing killed because file2 is about 40000 > > > long ,and file1 is about 25000 > > > > > > if I would do c program, It would have two nested for that will > > > take time too. > > > > > > please I will appriciate any suggestions. > > > > > > > From the description you have provided I would first try the Unix > > command-line program 'comm'. > > > > Try 'man comm' and look in particular at the '-3' option. > > > > Thank you very much. > > Jim Keenan > > > > >
I'd like to recommend an alternative to comm: combine (https://joeyh.name/code/moreutils/). I find its human readable boolean operators easier to remember than comm's numeric options! -Rob -- You received this message because you are subscribed to the Google Groups "ack users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/ack-users. For more options, visit https://groups.google.com/d/optout.
