Here is my current code

md5sum filename.iso | awk '{print $1} {print $2}'

This gives me two separate lines. The first line is the md5 of the file and the second line is the name of the file. I would like to save the md5 to md5.txt and the name of the file to name.txt The output of md5sum is xxxxxxx filename


An easy way is to use redirection, and you don't need to create two actions, you can put both of them in the same one, like:

md5sum filename.iso | awk '{ print $1 > "md5.txt"; print $2 > "name.txt" }'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.