Computing Staff
  • 0

Awk And Cksum

  • 0

I would like to list all my files like the following displaying

filename, size, cksum

displaying each one on a single line.

Using awk, I can do this much so far:

$ find Commands.txt -type f -printf “%f,%s\n” | awk -F “,” ‘
{cmd=”‘”`cksum`”‘” $1; cmd2=”‘”`awk ‘// {print $2}’`”‘”;for (i=1; i<NF; ++i) printf “%s,%d,%s\n”, $1,$2, cmd|cmd2 }’

However, it does not produces any output, nor it shows any error!

Could someone help please?

Thanks,
PG

Share

1 Answer

  1. Solved it somewhat:
    $ find Commands.txt -type f -printf “%f,%s\n” | awk -F “,” ‘
    {for (i=1; i<NF; ++i) printf "%s,%d,", $1,$2; system("cksum " $1 ) }'

    • 0