vp-32-csvBCCTASCA-csvHB.sh 747 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. # Conversione dei csv forniti da Bcc in csv importabili da Homebank
  3. echo "DATE;PAYMODE;INFO;PAYEE;MEMO;AMOUNT;CATEGORY;TAGS" > out_$1
  4. awk 'BEGIN {ORS=""; FS=";" }
  5. $1~/[0-9]/ {
  6. print $3 ";"; #date
  7. print ";"; #paymode
  8. print ";"; #info
  9. print ";"; #payee
  10. print $5 ";"; #memo
  11. print $6 ";"; #amount
  12. print ";" #category
  13. print "" #tags
  14. print "\n"
  15. if ($9) {
  16. print $3 ";"; #date
  17. print ";"; #paymode
  18. print ";"; #info
  19. print ";"; #payee
  20. print "Commissioni;"; #memo
  21. print $9 ";"; #amount
  22. print ";" #category
  23. print "" #tags
  24. print "\n"
  25. }
  26. }
  27. END {
  28. }
  29. ' $1 |
  30. iconv -f cp1251 -t utf-8 >> out_$1