Skip to content

Instantly share code, notes, and snippets.

@franciscojsc
Last active October 22, 2021 23:54
Show Gist options
  • Save franciscojsc/e60b5774ad880e4f1bf42e3c606e1235 to your computer and use it in GitHub Desktop.
Save franciscojsc/e60b5774ad880e4f1bf42e3c606e1235 to your computer and use it in GitHub Desktop.
Convert text list to MD5 hash list

Convert text list to MD5 hash list

Add execute permission to file:

chmod +x ./convert-list-hash.sh

Run the script, passing the file path:

./convert-list-hash.sh lista.txt

After running the script, a new file called new-file.txt will be created with the hash.

#!/bin/bash
# Author: Francisco Chaves <https://franciscochaves.com.br>
# Description: Convert text list to MD5 hash list
FILE=$1
cat $FILE | xargs -i bash -c "echo -n {} | md5sum | cut -d ' ' -f1 | tee -a new-file.txt"
123
456
789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment