Skip to content

Instantly share code, notes, and snippets.

@packeted
Last active August 20, 2018 06:22
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 packeted/462d7f8da1968f850de0284ba1e0be5e to your computer and use it in GitHub Desktop.
Save packeted/462d7f8da1968f850de0284ba1e0be5e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: ./hashscript <input> <output>
# Open terminal in Mac, type "nano hashscript", paste this in and save. Type "chmod +x hashscript" and make sure your data files are in the same directory
# Data format, rows of: example@domain.com,a,b,c,d,e where the first field is what you want to hash
for i in `cat $1`; do
IDENTIFIERFIELD="`echo $i | cut -d, -f 1 | tr -d ' ' | tr '[A-Z]' '[a-z]'`"
RESTOFINFO="`echo $i | cut -d, -f2-`"
IDENTIFIERFIELDHASH="`echo $IDENTIFIERFIELD | md5`"
echo $IDENTIFIERFIELDHASH,$RESTOFINFO >> $2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment