test
文件示例:
cat <<'EOF'> test
/boot/efi/EFI/debian/grubx64.efi root root 700 1625230722
/boot/efi/EFI/debian/mmx64.efi root root 700 1625230722
/boot/efi/EFI/debian/shimx64.efi root root 700 1625230722
/boot/grub/fonts/unicode.pf2 root root 644 1625230723
EOF
我计划在test
文件中再添加一列,新添加的列的值取决于第一列(md5sum --binary($1)
(,例如md5sum --binary /boot/efi/EFI/debian/grubx64.efi
。
我的脚本是awk '{ cmd = "md5sum --binary" close(cmd) $(NF+1) = (cmd($1)); print }' test > test_new
,但出现以下错误:
awk: line 1: syntax error at or near =
我是awk
的新手,有什么问题吗?
这个awk
应该工作:
awk '{cmd = "md5sum --binary 47" $1 "