#!/usr/bin/perl # based on code by Jeff Bilicki # modified by Ben Charlton # support added for RaQ3 .raq backup files. # # This code removes the custom header information from the backup file. use strict; my ($infile); my ($outfile); my ($end) = "\%\%END_INDEX"; my ($begin) = "\%\%BACKUP_HEADER"; my ($end2) = "\%\%END_XML"; my ($begin2) = "\%\%BACKUP_XML"; if (@ARGV) { $infile = $ARGV[0]; $outfile = $ARGV[1]; } else { print "usage: strip.pl \n\nOutput file should be a .tar.gz\n"; exit 1; } open (INFILE, $infile) or die "Can't open: $!\n"; open (OUTFILE, ">$outfile") or die "Can't open $!\n"; while () { if ( /^$begin/ ... /^$end/ ) { next; } else { if ( /^$begin2/ ... /^$end2/ ) { next; } else { print OUTFILE $_; } } } close(INFILE); close(OUTFILE); exit 0;