summaryrefslogtreecommitdiff
path: root/test/test_replace_timestamp.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_replace_timestamp.sh')
-rwxr-xr-xtest/test_replace_timestamp.sh10
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