Home > Software engineering >  Creating an md5sum via Automator without filename in destination file
Creating an md5sum via Automator without filename in destination file

Time:02-19

I’m using Automator to pull files from a folder and generate an md5 for each. This is all working but I don’t know how to only write the md5 itself to the destination file without the source file path.

for f in “@“
do
    echo “$f”
    md5 “$f” > “$f”.md5
done

This resulting file includes both.

CodePudding user response:

This might help with your loop to get only first column:

md5 "$f" | awk '{print $1}' > "$f".md5

Or only with bash:

md5 "$f" | while read -r sum foo; do echo "$sum"; done > "$f".md5
  • Related