Work on better partials matching.

This commit is contained in:
Dominik Pantůček 2023-07-29 15:51:15 +02:00
parent 9ca16fe6c5
commit ec804535c0
2 changed files with 9 additions and 6 deletions

View file

@ -236,7 +236,7 @@ first_acc_part() {
accno="$1"
ls "${BANK_DIR_PARTS}/" \
| grep "^$accno" \
| grep '.csv$' \
| grep '[-][0-9][0-9][0-9][0-9].csv$' \
| sort \
| head -n 1
}
@ -248,7 +248,7 @@ last_acc_part() {
accno="$1"
ls "${BANK_DIR_PARTS}/" \
| grep "^$accno" \
| grep '.csv$' \
| grep '[-][0-9][0-9][0-9][0-9].csv$' \
| sort -r \
| head -n 1
}
@ -261,7 +261,7 @@ all_but_first_parts() {
first="`first_acc_part $1`"
ls "${BANK_DIR_PARTS}/" \
| grep "^$accno" \
| grep '.csv$' \
| grep '[-][0-9][0-9][0-9][0-9].csv$' \
| sort \
| grep -v "$first"
}
@ -288,7 +288,7 @@ get_header_field() {
# $1 - account number
make_acc_header() {
first="`first_acc_part $1`"
last="`last_acc_part $2`"
last="`last_acc_part $1`"
firstfname="$BANK_DIR_PARTS/$first"
lastfname="$BANK_DIR_PARTS/$last"
make_acc_header_static "$firstfname"
@ -301,7 +301,7 @@ make_acc_header() {
}
#
# Creates the complete merged account statement
# Creates the complete merged account statement from yearly partials
# $1 - account number
merge_acc() {
make_acc_header "$1"