From fc2dae9e5628d6cbb0997736ee3413be9a336831 Mon Sep 17 00:00:00 2001 From: Mike Holloway Date: Sat, 26 Mar 2022 15:18:18 -0400 Subject: [PATCH] On branch parse-mdls Your branch is up to date with 'origin/parse-mdls'. Changes to be committed: modified: hash-files Added default keys_of_interest array Added output filter functionality leveraging keys_of_interest --- hash-files | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hash-files b/hash-files index 4fa3895..914f0e4 100755 --- a/hash-files +++ b/hash-files @@ -1,5 +1,6 @@ #!/usr/bin/env bash log_file=/var/log/hash-files.log +keys_of_interest={"kMDItemFSCreationDate" "kMDItemFSName"} md5_bin=$(which md5sum) mktemp_bin=$(which mktemp) DateTimeStamp=$(date +\%D_\%T) @@ -36,7 +37,11 @@ mdls_files () { for line in $(mdls $file); do mdls_key=$(printf "%s" $line | cut -d '=' -f 1) mdls_value=$(printf "%s" $line | cut -d '=' -f 2) - printf "\n============================\nMDLS Key: %s\nMDLS Value: %s\n============================\n\n" $mdls_key $mdls_value + if $(grep $mdls_key $keys_of_interest);then + printf "\n============================\nMDLS Key: %s\nMDLS Value: %s\n============================\n\n" $mdls_key $mdls_value + else + : + fi done done