Last active
June 8, 2018 03:24
-
-
Save tomatrow/0afb00d35794fbe92d5a6e875c673ee9 to your computer and use it in GitHub Desktop.
Revisions
-
tomatrow revised this gist
Jun 8, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ statements -
tomatrow revised this gist
Jun 4, 2018 . No changes.There are no files selected for viewing
-
tomatrow revised this gist
Jun 4, 2018 . 1 changed file with 35 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,49 +1,53 @@ #! /usr/local/bin/fish function main set data (cat statements.html) # echo $data | pup -c "tr:nth-of-type(5)" set i 5 while set res (echo $data | pup "tr:nth-of-type($i)") and [ "$res" != '' ] ###### Read in data # I need to `tr:nth-of-type($i)`, else direct children's tags are removed. echo $data | pup -p "tr:nth-of-type($i) > td:first-of-type text{}" \ | string trim | read transDate echo -n $data | pup -p "tr:nth-of-type($i) > td:nth-of-type(2) > b text{}" \ | string trim | read transDescription echo -n $data | pup -p "tr:nth-of-type($i) > td:nth-of-type(2) > div > div:first-of-type text{}" \ | string trim | read -z transMemo # I remove a bunch of whitespace by matching non empty lines echo -n $data | pup -p "tr:nth-of-type($i) > td:nth-last-of-type(2) text{}" \ | string match -r '[^\\s]+' \ | string trim -c ' ()\$' | read transAmount echo -n $data | pup -p "tr:nth-of-type($i) > td:last-of-type text{}" \ | string trim -c ' \$' | read transBalance ##### Transform # (1) convert date format strptime -i '%m/%d/%Y' -f '%Y/%m/%d' "$transDate" | read transDate ##### Display # (1) date description echo "$transDate $transDescription ; # $transBalance\n \$$transAmount" set i (math "$i + 1") end end set reversed (echo (main)[-1..1]) for line in $reversed echo -e $line end -
tomatrow created this gist
Jun 4, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ #! /usr/local/bin/fish set data (cat statements.html) echo $data | pup -c "tr:nth-of-type(5)" set i 5 while set res (echo $data | pup "tr:nth-of-type($i)") and [ "$res" != '' ] ###### Read in data # I need to `tr:nth-of-type($i)`, else direct children's tags are removed. echo $data | pup -p "tr:nth-of-type($i) > td:first-of-type text{}" \ | string trim | read transDate echo -n $data | pup -p "tr:nth-of-type($i) > td:nth-of-type(2) > b text{}" \ | string trim | read transDescription echo -n $data | pup -p "tr:nth-of-type($i) > td:nth-of-type(2) > div > div:first-of-type text{}" \ | string trim | read -z transMemo # I remove a bunch of whitespace by matching non empty lines echo -n $data | pup -p "tr:nth-of-type($i) > td:nth-last-of-type(2) text{}" \ | string match -r '[^\\s]+' \ | string trim -c ' ()\$' | read transAmount echo -n $data | pup -p "tr:nth-of-type($i) > td:last-of-type text{}" \ | string trim -c ' \$' | read transBalance ##### Transform # (1) convert date format strptime -i '%m/%d/%Y' -f '%Y/%m/%d' "$transDate" | read transDate ##### Display # (1) date description echo "$transDate $transDescription ; # $transBalance\n \$$transAmount" # (2) set i (math "$i + 1") end | while read line echo $line end