TAR with --to-command
<p>I'd like to calculate MD5 for all files in a tar archive. I tried tar with --to-command.<br/>
<code>tar -xf abc.tar --to-command='md5sum' </code><br/>
it outputs like below.<br/>
<code>cb6bf052c851c1c30801ef27c9af1968  -</code><br/>
<code>f509549ab4eeaa84774a4af0231cccae  -</code><br/><br/>
Then I want to replace '-' with file name.<br/>
<code>tar -xf abc.tar --to-command='md5sum | sed "s#-#$TAR_FILENAME#"'</code> <br/>it reports error.<br/>
<code>md5sum: |: No such file or directory
md5sum: sed: No such file or directory
md5sum: s#-#./bin/busybox#: No such file or directory
tar: 23255: Child returned status 1</code></p>