annotate bni-update @ 15:4391020b8ebd

Update latest bni structure
author nanaya <me@nanaya.pro>
date Fri, 08 Jun 2018 22:08:31 +0900
parents a696cc8f1ee1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
3be5d1679ce0 Add bni, rewrite javascript
nanaya <me@myconan.net>
parents:
diff changeset
1 #!/bin/sh
3be5d1679ce0 Add bni, rewrite javascript
nanaya <me@myconan.net>
parents:
diff changeset
2
3be5d1679ce0 Add bni, rewrite javascript
nanaya <me@myconan.net>
parents:
diff changeset
3 set -e
3be5d1679ce0 Add bni, rewrite javascript
nanaya <me@myconan.net>
parents:
diff changeset
4 set -u
3be5d1679ce0 Add bni, rewrite javascript
nanaya <me@myconan.net>
parents:
diff changeset
5
6
a696cc8f1ee1 Enforce basic paths
nanaya <me@myconan.net>
parents: 5
diff changeset
6 PATH="${PATH}:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin"
a696cc8f1ee1 Enforce basic paths
nanaya <me@myconan.net>
parents: 5
diff changeset
7
4
3be5d1679ce0 Add bni, rewrite javascript
nanaya <me@myconan.net>
parents:
diff changeset
8 _outdir="$(dirname "${0}")"
15
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
9 _outfile="bni-jpyidr.txt"
4
3be5d1679ce0 Add bni, rewrite javascript
nanaya <me@myconan.net>
parents:
diff changeset
10
15
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
11 curl -s http://www.bni.co.id/id-id/beranda/informasivalas \
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
12 | grep -F '<td class="align-center">JPY</td>' \
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
13 | tail -1 \
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
14 | sed -e 's/.*<td class="align-center">JPY<\/td><td class="align-right">\([0-9,.]*\)<\/td>.*/\1/' \
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
15 | sed -e 's/,/./' \
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
16 > "${_outdir}/${_outfile}.new"
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
17
4391020b8ebd Update latest bni structure
nanaya <me@nanaya.pro>
parents: 6
diff changeset
18 mv "${_outdir}/${_outfile}.new" "${_outdir}/${_outfile}"