skuska
skuska

Reputation: 53

Bash script md5sum

i have problem

My input file:

user1 password1
user2 password2

How to get in output

user1 paassword1  d857ed4f845fce06fbc5bb76
user2 password2   e10adc3949ba59abbe56

I use

md5=$(md5sum "$1" | cut -d ' ' -f 1)

but I do not know what's next

Upvotes: 0

Views: 637

Answers (1)

choroba
choroba

Reputation: 242123

#! /bin/bash
while read -r user passwd ; do
    md5=$(printf %s "$passwd" | md5sum | cut -c1-32)
    printf '%s %s %s\n' "$user" "$passwd" "$md5"
done

Upvotes: 2

Related Questions