Почему hexdump пытается читать через EOF?

Решение Perl:

$ perl -lne '$k{"$_:"}++ for split(/\b/); push @l,$_; }{
   map{s/\S+:/$k{$&}<2 ? " " x length($&) : $&/e; print}@l;' file
     0f a2                   cpuid  
     a9 01 00 00 00          test   eax,0x1
     74 01                   je     a <myFunc+0xa>
     c3                      ret    
a:   0f 0b                   ud2a

Это эквивалентно:

#!/usr/bin/perl
use strict;
my %wordsHash;
my @lines;
## Read the input file line by line, saving each
## line as $_. This is what 'perl -n` means.
while (<>) {
    ## Remove trailing newlines. This is done
    ## by -l in the one liner.
    chomp;
    ## Split the current line on word boundaries
    my @wordsArray=split(/\b/);
    ## Save each word + ":" as a key in the hash %wordsHash,
    ## incrementing the value by one each time the word
    ## is seen.
    foreach my $word (@wordsArray) {
        $wordsHash{"$word:"}++;
    }
    ## Add the line to the array @lines
    push @lines, $_;
}

## After the file has been read. ('}{' in the one-liner)
## Iterate over each line in @lines ( map{}@l in the one-liner)
foreach my $line (@lines) {
    ## Grab the first set of non-whitespace
    ## characters until the 1st ':'
    $line=~/\S+:/;
    ## $& is whatever was matched
    my $match=$&;
    ## If the match was seen only once
    ## as a word (all will be seen at least once)
    if ($wordsHash{$match}<2) {
        ## The replacement is as many spaces
        ## as $match has characters.
        my $rep = " " x length($match);
        ## Replace it in the line
        $line=~s/$match/$rep/;
    }
    ## Print the line
    print "$line\n";;
}
0
04.05.2019, 14:15
2 ответа

Чтобы скопировать файл на целевой хост:

scp file user@host:/destinationdir/

Чтобы скопировать файл с исходного хоста в текущий каталог:

scp user@host:/sourcedir/file.
0
28.01.2020, 03:44

Вы можете использовать scpдля, но я бы использовал mercurial(hg)и бит -ведро :Я бы контролировал версии всех своих файлов с помощью mercurial, затем я бы синхронизировал его с ведром -, чтобы я мог перетаскивать файлы на любую машину, какую захочу. Он также обеспечивает резервное копирование.

Если вы не хотите использовать битовое -ведро, вы можете включить локальный сервер mercurial и использовать его.

0
28.01.2020, 03:44

Теги

Похожие вопросы