Skip to content

Instantly share code, notes, and snippets.

@tkoz0
Created March 29, 2021 09:06
Show Gist options
  • Save tkoz0/91fe3c6b349bd40def24cb1107cff35b to your computer and use it in GitHub Desktop.
Save tkoz0/91fe3c6b349bd40def24cb1107cff35b to your computer and use it in GitHub Desktop.
Download OEIS B files
#!/bin/bash
# pass number of threads as $1
# runs prefix3-dl.sh with several prefixes simultaneously
seq -f '%03g' 0 999 | xargs -I {} -n 1 -P $1 ./prefix3-dl.sh {}
# as of writing this, the 999 can be changed to 342
# that will increase over time as more sequences are added
#!/bin/bash
# helper bash script to download some of the files based on first 3 digits
# pass 3 digits for $1 (000 through 999)
# all sequences whose number starts with $1 go in their own folder
echo $1
mkdir $1
for n in $(seq -f '%03g' 0 999)
do
# only download missing files so script can be interrupted
# this breaks if interrupted in the middle of a wget download however
if [ ! -f ./$1/b$1$n.txt ]
then
wget -c https://oeis.org/A$1$n/b$1$n.txt
mv ./b$1$n.txt ./$1/
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment