Lines 518-524
Link Here
|
518 |
[ "$DEBUG" == "on" ] && echo "BAD !" >&2 |
518 |
[ "$DEBUG" == "on" ] && echo "BAD !" >&2 |
519 |
fi |
519 |
fi |
520 |
|
520 |
|
521 |
path="$(dirname $(type -ap "$0" | "${TAIL}" -1))/dd_rescue" |
521 |
path="$(dirname $(type -ap "$0" | "${TAIL}" -n 1))/dd_rescue" |
522 |
|
522 |
|
523 |
if [ -x "$path" ] ;then |
523 |
if [ -x "$path" ] ;then |
524 |
version=$("$path" -V 2>&1 | grep "dd_rescue Version" | cut -f 3 -d " " | |
524 |
version=$("$path" -V 2>&1 | grep "dd_rescue Version" | cut -f 3 -d " " | |
Lines 664-670
Link Here
|
664 |
# new chunk doesn't overlap with current chunk |
664 |
# new chunk doesn't overlap with current chunk |
665 |
# Iterate, put current chunk in $goodchunk. |
665 |
# Iterate, put current chunk in $goodchunk. |
666 |
goodchunk="$(echo -en "$goodchunk\n$i")" |
666 |
goodchunk="$(echo -en "$goodchunk\n$i")" |
667 |
parsechunk="$(echo "$parsechunk" | "${TAIL}" +2)" |
667 |
parsechunk="$(echo "$parsechunk" | "${TAIL}" -n +2)" |
668 |
continue |
668 |
continue |
669 |
fi |
669 |
fi |
670 |
|
670 |
|
Lines 700-706
Link Here
|
700 |
if [ "$as_int" == "0" ] && [ "$ae_int" == "0" ] |
700 |
if [ "$as_int" == "0" ] && [ "$ae_int" == "0" ] |
701 |
then |
701 |
then |
702 |
# we forget about current chunk, and iterate. |
702 |
# we forget about current chunk, and iterate. |
703 |
parsechunk=$(echo "$parsechunk" | "${TAIL}" +2) |
703 |
parsechunk=$(echo "$parsechunk" | "${TAIL}" -n +2) |
704 |
continue |
704 |
continue |
705 |
fi |
705 |
fi |
706 |
|
706 |
|
Lines 709-715
Link Here
|
709 |
then |
709 |
then |
710 |
# grow new chunk to englobe current chunk. |
710 |
# grow new chunk to englobe current chunk. |
711 |
arg_stop=$i_stop |
711 |
arg_stop=$i_stop |
712 |
parsechunk=$(echo "$parsechunk" | "${TAIL}" +2) |
712 |
parsechunk=$(echo "$parsechunk" | "${TAIL}" -n +2) |
713 |
|
713 |
|
714 |
break; # we can break because chunk are sorted. |
714 |
break; # we can break because chunk are sorted. |
715 |
fi |
715 |
fi |
Lines 719-725
Link Here
|
719 |
then |
719 |
then |
720 |
# grow new chunk to englobe current chunk. |
720 |
# grow new chunk to englobe current chunk. |
721 |
arg_start=$i_start |
721 |
arg_start=$i_start |
722 |
parsechunk=$(echo "$parsechunk" | "${TAIL}" +2) |
722 |
parsechunk=$(echo "$parsechunk" | "${TAIL}" -n +2) |
723 |
continue; # new chunk might overlap more chunks |
723 |
continue; # new chunk might overlap more chunks |
724 |
fi |
724 |
fi |
725 |
|
725 |
|
Lines 748-754
Link Here
|
748 |
# finding last's chunk end. |
748 |
# finding last's chunk end. |
749 |
|
749 |
|
750 |
if test "$chunk" ;then |
750 |
if test "$chunk" ;then |
751 |
last_chunk=$(echo "$chunk" | "${TAIL}" -1 ) |
751 |
last_chunk=$(echo "$chunk" | "${TAIL}" -n 1 ) |
752 |
max_stop=$(echo "$last_chunk" | "${CUT}" -f 2 -d "-") |
752 |
max_stop=$(echo "$last_chunk" | "${CUT}" -f 2 -d "-") |
753 |
else |
753 |
else |
754 |
max_stop=0 |
754 |
max_stop=0 |
Lines 797-803
Link Here
|
797 |
function swallow_last_summary() |
797 |
function swallow_last_summary() |
798 |
{ |
798 |
{ |
799 |
# last summary of log (4 lines output by printreport()) |
799 |
# last summary of log (4 lines output by printreport()) |
800 |
last_logcontent=$("${CAT}" "$logfile" | "$tr" -d "\\r" | "$GREP" "$string" -A 3 | "${TAIL}" -4) |
800 |
last_logcontent=$("${CAT}" "$logfile" | "$tr" -d "\\r" | "$GREP" "$string" -A 3 | "${TAIL}" -n 4) |
801 |
process_log "$last_logcontent" |
801 |
process_log "$last_logcontent" |
802 |
|
802 |
|
803 |
get_eof |
803 |
get_eof |
Lines 811-817
Link Here
|
811 |
function get_last_chunk() |
811 |
function get_last_chunk() |
812 |
{ |
812 |
{ |
813 |
if test "$chunk"; then |
813 |
if test "$chunk"; then |
814 |
last_chunk="$(echo "$chunk" | "${TAIL}" -1 )" |
814 |
last_chunk="$(echo "$chunk" | "${TAIL}" -n 1 )" |
815 |
echo "$last_chunk" | "${CUT}" -f 2 -d "-" |
815 |
echo "$last_chunk" | "${CUT}" -f 2 -d "-" |
816 |
else |
816 |
else |
817 |
echo 0 |
817 |
echo 0 |
Lines 977-984
Link Here
|
977 |
|
977 |
|
978 |
while test "$parsing" |
978 |
while test "$parsing" |
979 |
do |
979 |
do |
980 |
firstline="$(echo "$parsing" | "${HEAD}" -1)" |
980 |
firstline="$(echo "$parsing" | "${HEAD}" -n 1)" |
981 |
parsing="$(echo "$parsing" | "${TAIL}" +2)" |
981 |
parsing="$(echo "$parsing" | "${TAIL}" -n +2)" |
982 |
|
982 |
|
983 |
xferd="$(echo "$firstline" | "${CUT}" -f 2 -d ":" | "${CUT}" -f 2 -d "=")" |
983 |
xferd="$(echo "$firstline" | "${CUT}" -f 2 -d ":" | "${CUT}" -f 2 -d "=")" |
984 |
errxfer="$(echo "$firstline" | "${CUT}" -f 4 -d ":" | "${CUT}" -f 2 -d "=")" |
984 |
errxfer="$(echo "$firstline" | "${CUT}" -f 4 -d ":" | "${CUT}" -f 2 -d "=")" |
Lines 1069-1076
Link Here
|
1069 |
# chunk="" |
1069 |
# chunk="" |
1070 |
|
1070 |
|
1071 |
while test "$parsing" ;do |
1071 |
while test "$parsing" ;do |
1072 |
firstline="$(echo "$parsing" | "${HEAD}" -1)" |
1072 |
firstline="$(echo "$parsing" | "${HEAD}" -n 1)" |
1073 |
parsing="$(echo "$parsing" | "${TAIL}" +2)" |
1073 |
parsing="$(echo "$parsing" | "${TAIL}" -n +2)" |
1074 |
|
1074 |
|
1075 |
ipos="$(echo $firstline | "${CUT}" -f 1 -d ":" | "${CUT}" -f 2 -d "=")" |
1075 |
ipos="$(echo $firstline | "${CUT}" -f 1 -d ":" | "${CUT}" -f 2 -d "=")" |
1076 |
xferd="$(echo $firstline | "${CUT}" -f 2 -d ":" | "${CUT}" -f 2 -d "=")" |
1076 |
xferd="$(echo $firstline | "${CUT}" -f 2 -d ":" | "${CUT}" -f 2 -d "=")" |
Lines 1107-1125
Link Here
|
1107 |
# loading into memory Summary info found in log file... |
1107 |
# loading into memory Summary info found in log file... |
1108 |
# |
1108 |
# |
1109 |
# line number of last save_log entry... |
1109 |
# line number of last save_log entry... |
1110 |
lnb_save=$("${CAT}" -n "$logfile" | "$tr" -d "\\r" | grep "chunk:" -A 2 | "${TAIL}" -3) |
1110 |
lnb_save=$("${CAT}" -n "$logfile" | "$tr" -d "\\r" | grep "chunk:" -A 2 | "${TAIL}" -n 3) |
1111 |
|
1111 |
|
1112 |
|
1112 |
|
1113 |
if test "$lnb_save" ;then |
1113 |
if test "$lnb_save" ;then |
1114 |
lnb_save=$(echo $lnb_save | "${HEAD}" -1 | cut -f 1 -d " ") |
1114 |
lnb_save=$(echo $lnb_save | "${HEAD}" -n 1 | cut -f 1 -d " ") |
1115 |
|
1115 |
|
1116 |
end_log="$(cat "$logfile" | "$tr" -d "\\r" | "${TAIL}" "+$lnb_save")" |
1116 |
end_log="$(cat "$logfile" | "$tr" -d "\\r" | "${TAIL}" -n "+$lnb_save")" |
1117 |
|
1117 |
|
1118 |
last_lines=$(echo "$end_log" | grep "chunk:" -A 2 | "${TAIL}" -3) |
1118 |
last_lines=$(echo "$end_log" | grep "chunk:" -A 2 | "${TAIL}" -n 3) |
1119 |
|
1119 |
|
1120 |
log=$(echo "$last_lines" | "$GREP" "chunk" | "${TAIL}" -1 ) |
1120 |
log=$(echo "$last_lines" | "$GREP" "chunk" | "${TAIL}" -n 1 ) |
1121 |
log1=$(echo "$last_lines" | "$GREP" "logcontent" | "${TAIL}" -1 ) |
1121 |
log1=$(echo "$last_lines" | "$GREP" "logcontent" | "${TAIL}" -n 1 ) |
1122 |
log2=$(echo "$last_lines" | "$GREP" "eof" | "${TAIL}" -1 ) |
1122 |
log2=$(echo "$last_lines" | "$GREP" "eof" | "${TAIL}" -n 1 ) |
1123 |
|
1123 |
|
1124 |
if test "$log" && test "$log1" && test "$log2" ;then |
1124 |
if test "$log" && test "$log1" && test "$log2" ;then |
1125 |
chunk="$(echo "$log" | "${CUT}" -f 2- -d ":" | "${TR}" ":" "\n")" |
1125 |
chunk="$(echo "$log" | "${CUT}" -f 2- -d ":" | "${TR}" ":" "\n")" |