[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Where to get stripheader.pl?



----- Original Message -----
From: "Tomás García Ferrari" <tgf@xxxxxxxxxxx>
To: "Cobalt Users" <cobalt-users@xxxxxxxxxxxxxxx>
Sent: Monday, November 11, 2002 11:03 AM
Subject: [cobalt-users] Where to get stripheader.pl?


> Hello!
>
> I need to extract some files from a .raq backup, and I'm trying to find
this
> script. All the links are pointing to:


This is a slightly amended version, but works.

You will get an error, when you run it. Ignore that.


Rgds

Bassi

#!/usr/bin/perl

use strict;

my $infile = '_complete_20010809-0204.raq';
my $outfile = 'raqout.tar.gz';

my ($end) = "\%\%END_INDEX";
my ($begin) = "\%\%BACKUP_HEADER";
my ($end2) = "\%\%END_XML";
my ($begin2) = "\%\%BACKUP_XML";

open (INFILE, $infile) or die "Can't open: $!\n";
binmode INFILE;
        open (OUTFILE, ">$outfile") or die "Can't open $!\n";
        binmode OUTFILE;

        while (<INFILE>) {
                if ( /^$begin/ ... /^$end/ ) {
                        next;
                } else {
                        if ( /^$begin2/ ... /^$end2/ ) {
                                next;
                        } else {
                                print OUTFILE $_;
                        }
                }
        }
        close(INFILE);
close(OUTFILE);