简体   繁体   中英

How to combine 2 bash commands with print0 included

Bash version: 3.5

I have 2 favorite commands, that i use a lot

here's my code

  1. find . -type f -print0 | xargs -0 md5sum -b

  2. find . -type f -print0 | xargs -0 stat -c "%y"

How to combine them and get result similar to my expectation below.

Result:

4d452a2b17f0a6ea9408f959ad7a28a35d67c810 2016-06-28 16:09:34.000000000 211 ./DEW-FILES_COPY_2016-06-28_16092425_.bat

这条路:

find . -type f -exec bash -c 'file={};m5s=$(md5sum -b  $file|cut -d" " -f1);echo "$m5s "$(stat -c "%y" $file)" $file"' \;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM