Plik wejściowy w formacie konfiguracji do backuppc:
Kod: Zaznacz cały
$Conf{BackupFilesOnly} = {
'/var/vmail/vmail1/domena.pl' => [
''
],
'/etc' => [
''
]
};
$Conf{XferMethod} = 'tar';
$Conf{XferLogLevel} = '2';
$Conf{ClientNameAlias} = '8.8.8.8';
$Conf{RsyncShareName} = [
'/etc',
'/var/vmail/vmail1/domena.pl'
];
$Conf{RsyncClientPath} = '/usr/bin/rsync';
$Conf{RsyncClientCmd} = '/usr/bin/sudo $rsyncPath $argList+ $shareName';
$Conf{RsyncClientRestoreCmd} = '/usr/bin/sudo $rsyncPath $argList+ $shareName';
$Conf{RsyncArgs} = [
'--numeric-ids',
'-a',
'--hard-links',
'--block-size=2048',
'--specials'
];
$Conf{TarShareName} = [
'/etc',
'/var/vmail/vmail1/domena.pl/p/o/s/postmaster',
'/var/vmail/vmail1/domena.pl/asdasdasd',
'/var/vmail/vmail1/domena.pl/fdgsdfgsdf',
'/var/vmail/vmail1/domena.pl/sdgdfbsdfb',
'/var/vmail/vmail1/domena.pl/sdfvzcxv',
'/var/vmail/vmail1/domena.pl/sruhyegrtefs',
'/var/vmail/vmail1/domena.pl/dutyrseafsd',
'/var/vmail/vmail1/domena.pl/z',
'/var/vmail/vmail1/domena.pl/aersrjhtgdfv',
'/var/log/archive'
];
$Conf{FullPeriod} = '30';
$Conf{IncrLevels} = [
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15'
];
$Conf{BlackoutPeriods} = [
{
'hourEnd' => '17.5',
'weekDays' => [
'1',
'2',
'3',
'4',
'5'
],
'hourBegin' => '7'
}
];
Kod: Zaznacz cały
awk '/TarShareName/,/];/' conf.pl > to_usunac
Kod: Zaznacz cały
$Conf{TarShareName} = [
'/etc',
'/var/vmail/vmail1/domena.pl/p/o/s/postmaster',
'/var/vmail/vmail1/domena.pl/asdasdasd',
'/var/vmail/vmail1/domena.pl/fdgsdfgsdf',
'/var/vmail/vmail1/domena.pl/sdgdfbsdfb',
'/var/vmail/vmail1/domena.pl/sdfvzcxv',
'/var/vmail/vmail1/domena.pl/sruhyegrtefs',
'/var/vmail/vmail1/domena.pl/dutyrseafsd',
'/var/vmail/vmail1/domena.pl/z',
'/var/vmail/vmail1/domena.pl/aersrjhtgdfv',
'/var/log/archive'
];
Czego próbowałem i z jaki efektem:
Kod: Zaznacz cały
comm --nocheck-order -3 conf.pl to_usunac
comm --nocheck-order -13 conf.pl to_usunac
Kod: Zaznacz cały
awk 'FNR==NR { a[$0]; next } !($0 in a)' to_usunac conf.pl > conf2.pl
Kod: Zaznacz cały
diff --changed-group-format="%>" --unchanged-group-format="" to_usunac conf.pl > conf2.pl
Kod: Zaznacz cały
diff conf.pl conf2.pl
26,37d25
< $Conf{TarShareName} = [
< '/etc',
< '/var/vmail/vmail1/domena.pl/p/o/s/postmaster',
< '/var/vmail/vmail1/domena.pl/asdasdasd',
< '/var/vmail/vmail1/domena.pl/fdgsdfgsdf',
< '/var/vmail/vmail1/domena.pl/sdgdfbsdfb',
< '/var/vmail/vmail1/domena.pl/sdfvzcxv',
< '/var/vmail/vmail1/domena.pl/sruhyegrtefs',
< '/var/vmail/vmail1/domena.pl/dutyrseafsd',
< '/var/vmail/vmail1/domena.pl/z',
< '/var/vmail/vmail1/domena.pl/aersrjhtgdfv',
< '/var/log/archive'
69d56
< ];
Do tego próby z grepami, sedami awkami tr, perlem... no rozbijam się o znaki ${} i multilinię.