diff options
author | Oskar <> | 2024-11-03 15:39:31 +0100 |
---|---|---|
committer | Oskar <> | 2024-11-03 15:39:31 +0100 |
commit | 847b56294b70ed7bbef0fcf2fb25ef878581568c (patch) | |
tree | e6a06b995634ad7c740cd253d5f2e28eee0bb18e /test/test_replace_timestamp.sh | |
parent | b4804185ef139871f308497cf6af045a9fed0a7a (diff) |
functions to remove all trashed files, and to remove old trashed files. Not fully tested. Also modified a script that replaces timestampsHEADmaster
Diffstat (limited to 'test/test_replace_timestamp.sh')
-rwxr-xr-x | test/test_replace_timestamp.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/test_replace_timestamp.sh b/test/test_replace_timestamp.sh index ffad66e..a8f44b9 100755 --- a/test/test_replace_timestamp.sh +++ b/test/test_replace_timestamp.sh @@ -3,7 +3,7 @@ LOG_DIR="/home/oskar/.trashsys/log" if [ -z "$1" ]; then - echo "Usage: $0 <replacement_string>" + echo "Usage: $0 <replacement_timestamp>" exit 1 fi @@ -16,8 +16,12 @@ fi for file in "$LOG_DIR"/*; do if [ -f "$file" ]; then - echo "replacing trashed time in: $file" - awk -v replacement="$REPLACEMENT" 'NR % 5 == 0 {print replacement} NR % 5 != 0 {print $0}' "$file" > "$file.tmp" && mv "$file.tmp" "$file" + echo "Replacing timestamp in: $file" + awk -v replacement="$REPLACEMENT" '{ + # Replace the fifth field (timestamp) with the replacement string + $5 = replacement + print $0 + }' "$file" > "$file.tmp" && mv "$file.tmp" "$file" fi done |