-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathget-addresses.sh
executable file
·39 lines (31 loc) · 1019 Bytes
/
get-addresses.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
main () {
# Make addresses directory if it doesn't exist
if [ ! -d "addresses" ]; then
mkdir addresses;
fi
# Delete the addresses if it exists
if [ -f "addresses/addresses.csv" ]; then
rm addresses/addresses.csv;
fi
touch addresses/addresses.csv;
# Download all the files that make up the addresses
for i in {0..9}; do
# Only download if doesn't exist
if [ ! -f "addresses/part$i.gz" ]; then
echo "Downloading part$i.gz";
wget https://storage.googleapis.com/ethereum-addresses/addresses00000000000$i -O addresses/part$i.gz;
fi
# Unzip if doesn't exist
if [ ! -f "addresses/part$i.csv" ]; then
echo "Decompressing part$i.csv";
gunzip -c addresses/part$i.gz > addresses/part$i.csv;
fi
tail -n +2 "addresses/part$i.csv" >> addresses/addresses.csv;
rm "addresses/part$i.csv" "addresses/part$i.gz";
done
local LINES;
LINES=$(wc -l < addresses/addresses.csv)
printf "Done grabbing and parsing address files, %s addresses loaded.\n" "$LINES";
}
main;