Skip to content

Instantly share code, notes, and snippets.

@zstumgoren
Forked from irenecasado/ca_failed_banks.sh
Last active January 31, 2022 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zstumgoren/3299c56fb4dab04a374067616545f29e to your computer and use it in GitHub Desktop.
Save zstumgoren/3299c56fb4dab04a374067616545f29e to your computer and use it in GitHub Desktop.
ca_failed_banks.sh
# No need for creating new directories with this script. Note, if you were to use "mkdir-p" it requires a path to a directory
# as its argument. For example, "mkdir -p ~/code/example"
# mkdir -p
# cd code
curl -s --output banklist.csv https://www.fdic.gov/resources/resolutions/bank-failures/failed-bank-list/banklist.csv
# No need to touch the file
# touch ca_failed_banks.csv
# Instead, create it using head
head -1 banklist.csv > ca_failed_banks.csv
# You should delete extraneous commands not needed by the script such as below "cat" statement
# cat ca_failed_banks.csv
grep CA banklist.csv >> ca_failed_banks.csv
ROW_COUNT=`wc -l < ca_failed_banks.csv | xargs`
NUM_BANKS=$(($ROW_COUNT - 1))
echo "There are ${NUM_BANKS} failed banks in California"
# There are 41 failed banks in California.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment