From owner-freebsd-questions Thu Jan 31 8: 7:11 2002 Delivered-To: freebsd-questions@freebsd.org Received: from web21203.mail.yahoo.com (web21203.mail.yahoo.com [216.136.130.22]) by hub.freebsd.org (Postfix) with SMTP id 9FFA437B400 for ; Thu, 31 Jan 2002 08:06:55 -0800 (PST) Message-ID: <20020131160655.42352.qmail@web21203.mail.yahoo.com> Received: from [24.100.124.207] by web21203.mail.yahoo.com via HTTP; Fri, 01 Feb 2002 00:06:55 CST Date: Fri, 1 Feb 2002 00:06:55 +0800 (CST) From: =?iso-8859-1?q?adrian=20kok?= Subject: Re: compare two files To: Joel Dinel Cc: questions@FreeBSD.ORG In-Reply-To: <20020131105553.A39923@sunder.touchtunes.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Joel But the diff also outputs the data of fileB I only need fileA data whether it exists to fileB Thank you --- Joel Dinel wrote: > It already exists, and it's called 'diff'. > > man diff > > > On Thu, Jan 31, 2002 at 11:50:13PM +0800, adrian kok > wrote: > > Date: Thu, 31 Jan 2002 23:50:13 +0800 (CST) > > From: adrian kok > > Subject: compare two files > > To: freebsd-questions@FreeBSD.ORG > > > > I would like to know how to write script or > program to > > compare two file > > > > two files: file1 and file2 > > > > check data of file1 whether exists in file2 > > > > if not > > > > write this data in file1 or output to file > > > > #!/bin/sh > > $lista=fopen("a.txt", "r"); > > $listb=fopen("b.txt", "r"); > > > > while(!feof($lista)) { > > $dmbuffer = fgets ($lista); > > grep $dmbuffer $listb > diff; > > } > > > > Could you teach me or where can I get this > information > > from website > > > > TIA > > > > > > > _______________________________________________________________________ > > Do You Yahoo!? > > Get your free @yahoo.com.hk address at > http://mail.english.yahoo.com.hk > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-questions" in the body > of the message > ---end quoted text--- > > -- > Joel Dinel > System Administrator > TouchTunes Digital Jukebox, Inc. > GnuPG key : http://darkhost.mine.nu:81/~joel/misc/mykey.asc _______________________________________________________________________ Do You Yahoo!? Get your free @yahoo.com.hk address at http://mail.english.yahoo.com.hk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message