HDD 等のサルベージ用コピーツール
#!/usr/bin/gawk -f BEGIN { W = 64; // width of map addr = 0; s = ""; } NF == 3 { n = strtonum($2) / 512; for (i = 0; i < n; i++) { s = s $3; if (W <= length(s)) { printf("%08x %s\n", addr, s); s = ""; addr += W; # skip continuous lines continuous = int((n - i) / W); if (0 < continuous) { printf("<skip %d lines %s>\n", continuous, $3); addr += continuous * W; i += continuous * W; } } } } END { printf("%08x %s\n", addr, s); }
#!/usr/bin/gawk -f BEGIN { bad_sector = non_split = non_trimmed = finished = non_tried = 0; } $3 == "-" {bad_sector += strtonum($2);} $3 == "/" {non_split += strtonum($2);} $3 == "*" {non_trimmed += strtonum($2);} $3 == "+" {finished += strtonum($2);} $3 == "?" {non_tried += strtonum($2);} END { info("?", non_tried); info("+", finished); info("-", bad_sector); info("/", non_split); info("*", non_trimmed); info("-/*", bad_sector + non_split + non_trimmed); } function info(stat, size) { printf("%-3s: %17s bytes (%13s blocks)\n", stat, numsep(size), numsep(size / 512)); } function numsep(v, _h, _l) { if (3 < length(v)) { _l = substr(v, length(v) - 2, 3); _h = substr(v, 0, length(v) - 3); return numsep(_h) "," _l; } else { return v; } }
ubuntu@ubuntu:~$ ./show_ddrescue_log.awk W=64 ddrescue.log | tee map 00000000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <skip 969 lines +> 0000f280 ++++++++++++++++++++++++++++++++++++++++++++++++---------------- 0000f2c0 -----------------------------+-+------+------------+-----+------ 0000f300 --------+------------------+------+-----------------------+-+--- 0000f340 -------+----------+----+-+------+----++-------------++-+-++-+--- 0000f380 -----+++++++++++++++++++++++++++++++++++++++++++--++++----+--+-+ 0000f3c0 ------------+-+---+-----------------+-----------+---------+----- 0000f400 +------+----++--------+--++++--+-++---+-+--++-+-----------+---+- 0000f440 ---+----------+------+-----+-----++----+--+--++-------------+--- 0000f480 +--+---+++---++-++++++++++-++--++--++--+-+--+-+++++--++-+-+-++-+ 0000f4c0 ++-+++-+---+++++++++-+++++++++++++-+-+++++-+++--+-++++++---+++++ 0000f500 +---+++--+--++--+-+-+-----+++--+++-+---+--++++++---++---+-++++-+ 0000f540 --++++-++-++-++--+-+--++---+--+++-+++++++--+++++++--++--++-++--- 0000f580 +---+++--+-+++-+++--+--+-+-+++--+++-+-++++---+++---++++++++-+-++ 0000f5c0 +---+-----++-+++-+++++++-++++-++++++++++++++-+-++--++++++-++++++ 0000f600 ++++++--+-++++-+--+++++++++-++++++++++++++-++++-+++++++++-++++++ 0000f640 +++-+-+-+-+++++-+++++-+-++--+++++-+++++++-+++-+++--++++-++++++++ 0000f680 ++++++++-++++-++++++++++++++++++++++++++++++++++++++++++++++++++ 0000f6c0 +++++++++++++++++++++++++++++++-+-+++++++++++++++++++++++-++++-+ 0000f700 ++++++++++++++++-+++++++++++++++++++++++++++++++++-+++++-+++++++ 0000f740 ++++++++++-++++++++++++++-++++++++++++-+++++++++++++++++++++++++ 0000f780 +++-+++-+++++++++++++++++++++++++++-++++++++++++++++++++++++++-+ 0000f7c0 +-+-+++++-++-+++++++++++-++++++++++-+-++++++++++++-+++++++++++-+ 0000f800 +++++++++++++-+++++++++++-+++++++++++-++++++++++++++--++-+++++++ 0000f840 ++++++++--+++++--+++++++-+++--+++++++++--+-+-++++++-+++++++--+++ 0000f880 +++++++-++-+++-+++++++++++++++++++-+++++++++++++-+++++-++-+++-++ 0000f8c0 ++++-++++--+++++++++++--+++++-+++-+-+++-+++-++++---+++-+++-+--++ 0000f900 +---++-++++--+++++++++++-+-+-++--++++++-++-+++++-++++++-++++++-- 0000f940 -++++++-+-+-+-++-+-++---++-+++++-++++++++++++++-+-+--+++-++---++ 0000f980 ++++++++-+-+---++++-++++----+-+-+--++-++-+-///////////////////// <skip 2 lines /> 0000fa40 //////////////////////////////////////////////////////////////-- 0000fa80 //////////////////////////////////////////////////////////////// <skip 30 lines /> 00010240 ///////////////////////////////////////////--/////////////////// 00010280 ///////////////-++++++++++++++++++++++++++++++++++++++++++++++++ <skip 63 lines +> 00011280 ++++++++++++++++++++++++++++++++++++++++-/////////////////////// 000112c0 ///////////////////////////////////////////////////////-++++++++ <skip 30522730 lines +> 74706d80 ++++++++++++++++++++++++++++++++++++++++++++++++ ubuntu@ubuntu:~$ ./calc_ddrescue_log.awk ddrescue.log ? : 0 bytes ( 0 blocks) + : 1,000,203,348,992 bytes (1,953,522,166 blocks) - : 333,824 bytes ( 652 blocks) / : 1,203,200 bytes ( 2,350 blocks) -/ : 1,537,024 bytes ( 3,002 blocks)
タグ
コメントをかく