From owner-freebsd-questions@FreeBSD.ORG Sun May 17 21:29:19 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B58CC1065692 for ; Sun, 17 May 2009 21:29:19 +0000 (UTC) (envelope-from kelly.terry.jones@gmail.com) Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.24]) by mx1.freebsd.org (Postfix) with ESMTP id 719638FC18 for ; Sun, 17 May 2009 21:29:19 +0000 (UTC) (envelope-from kelly.terry.jones@gmail.com) Received: by qw-out-2122.google.com with SMTP id 3so1938485qwe.7 for ; Sun, 17 May 2009 14:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=Zc7YvDlxl+glfC5TIAoh8V65Unpm6aWqsBrHcT4to8A=; b=ah3rPXPfzqGJYFnT9JBeDW/0Fc3na7fSG36YdW6Rm7Alw0yHKJ1pbi8eKKFhYfsnmY CLXsaReFnOpB1B2PrldlNses37rOjCfHg3n7uDtp9XobVthOAPKMl+U9Z95VPVZOo6KR 5fCYJ7o4VBUYIjrveKSO6mwMz7sEu/8bbrge8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=LXtN8NesBsfC2kEIr7//89tDswpWe+lj7ojOYzH23goViLyGQT+EabiS50HpRhRtRC n+nwhtTFLGaOC6mD4W2Ulsj3N8Fj1ukTyWYG57Ypf3kn/zQ44PF0/f4UhHov4y0UZd0V 62XGMllKKo7cU8rppusblQp0P1TxBTTLaSxBg= MIME-Version: 1.0 Received: by 10.229.82.68 with SMTP id a4mr2918884qcl.18.1242595758454; Sun, 17 May 2009 14:29:18 -0700 (PDT) Date: Sun, 17 May 2009 14:29:18 -0700 Message-ID: <26face530905171429x7cb58cbcv488b6d9397310a2e@mail.gmail.com> From: Kelly Jones To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Better version of diff? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 May 2009 21:29:20 -0000 I often need to compare two Perl files sans comments. This mostly works: egrep -v '^#' file1.pl > file1.tmp egrep -v '^#' file2.pl > file2.tmp diff -B file1.tmp file2.tmp (yes, it breaks for perldoc style comments, comments on lines w/ code, # characters inside HERE docs, and probably other cases-- just an approximation) I also often need to see if two files contain the same lines, minus comments and allow duplicates. This mostly works: egrep -v '^#' file1.txt | sort | uniq > file1.tmp egrep -v '^#' file2.txt | sort | uniq > file2.tmp diff -B file1.tmp file2.tmp;: comm would also work here I could easily Perl script these two tasks, but my question is: has anyone created a "super diff" that does this sort of thing and more? -- We're just a Bunch Of Regular Guys, a collective group that's trying to understand and assimilate technology. We feel that resistance to new ideas and technology is unwise and ultimately futile.