#! /usr/bin/perl # # trim -- run through output of diff -ru and allows # the user to delete extraneous stuff. # Copyright (C) Stuart Brorson 10.30.2003 sdb@cloud9.net # #---------------------- GPL notification ---------------------------- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA #--------------------------------------------------------------------- $Basefilename = pop(@ARGV); # Beware -- trim doesn't do any checking! print "Trim -- copyright (C) Stuart Brorson. 10.31.2003.\n"; print "Processing $Basefilename \n\n"; open(InFile, "<$Basefilename"); open(OutFile, ">$Basefilename.new"); $Mode = "save"; while ($line = ) { if ($line =~ /^diff /) { printf ("\n\nSection = %s\n", $line); print ("Delete (y/N)?\n"); $Response = ; if ($Response =~ /^y/) { $Mode = "del"; } else { $Mode = "save"; } } if ($Mode eq "save") { print OutFile $line; print $line; } } close(InFile); close(OutFile);