inspector/grep.search_by_name

24 lines
734 B
Bash
Executable File

#!/bin/bash
# params: $1 name of the player for which we are looking
# $2 amount of results to show (before and after the action)
# $3 timestamp around which the actions ought to be shown
# $4 name of the moderator who initiated the search
ROLLBACK_FILE="/usr/local/src/mt/rollback.txt"
TMP_FILE="/tmp/mt.inspector.mode2.$4"
# remove old result files
rm -f $TMP_FILE $TMP_FILE.tmp
echo ' ' > $TMP_FILE.tmp
# dirt turning into dirt_with_grass, water flowing etc.
# modify_inventory_stack is not that intresting/helpful in this case
grep " \"player:$1\"" $ROLLBACK_FILE | grep -v "\] actor_is_guess" | grep " \[set_node " | grep -C $2 $3 >$TMP_FILE.tmp
# rename the result
mv $TMP_FILE.tmp $TMP_FILE