I am given a file containing the md5 values for files within the same folder. The information is in the file md5checksums.txt
in the following format:
b0da7ead9d82a3494d7e0a7099871ef4 ./GCF_000959505.1_ASM95950v1_assembly_report.txt
7ff32cbb16daf46c87b3546ad576ff66 ./GCF_000959505.1_ASM95950v1_assembly_stats.txt
034081da3aa0708f06c2ec1129e4aca9 ./GCF_000959505.1_ASM95950v1_cds_from_genomic.fna.gz
I want to do md5 checks for all the files. I got this command:
awk '{system("md5 "$2)}' md5checksums.txt
But this just gets the md5 values
MD5 (./GCF_000959505.1_ASM95950v1_assembly_report.txt) = b0da7ead9d82a3494d7e0a7099871ef4
MD5 (./GCF_000959505.1_ASM95950v1_assembly_stats.txt) = 7ff32cbb16daf46c87b3546ad576ff66
MD5 (./GCF_000959505.1_ASM95950v1_cds_from_genomic.fna.gz) = 3a30966523a36368ab432f666001f80a
I would like to extract the calculated md5 against the first column of md5checksums.txt
I thought I could do something like an awk inside an awk, but I can't get it to work:
awk '{system("md5 "$2" | awk HERE EVALUATE RESULTS AND CHECK IF EQUAL TO $1")}' md5checksums.txt
md5
the-r
option to produce the same output format asmd5sum
.md5sum -r
Or see if same file comme with new name ?$
to stop it being interpreted by the outer awk. I am sure there are better answers though.