#!/usr/bin/perl
use strict;
use warnings;
my $rader = 0; my $filer = 0; my $done = 0; my $likaef = 0;
while(<STDIN>) {
  my $ldevice = ""; my $linode = ""; my $lfile = "";
  $rader++;
  chop;
  s/ /\000/g;
  s/\134\000/\040/g;
  my @rad = split(/\000/);
  foreach my $file (@rad) {
    $filer++;
    my ($device, $inode, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) = stat($file);
    if ($ldevice eq $device && $linode ne $inode) {
      rename $file,"${file}ClynyectoigyacsobApcabercAtOid6cen";
      if (link $lfile,$file) {
        unlink "${file}ClynyectoigyacsobApcabercAtOid6cen";
        $done++;
      }
    } else {
      $ldevice = $device;
      $linode = $inode;
      $likaef++;
    }
    $lfile = $file;
  }
}
my $failade = $filer - $likaef - $done;
printf "rader fr fdupes %7d\nfiler %17d\nomlänkade %13d\nfailade %15d\n",$rader,$filer,$done,$failade;