-
Notifications
You must be signed in to change notification settings - Fork 5
/
res_tools
executable file
·35 lines (31 loc) · 1.04 KB
/
res_tools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Copyright (c) 2014, Redmaner
parse_ignorelist_mxcr () {
TARGET_FILE=$1
NEW_FILE=$2
cat $TARGET_FILE | grep '<item ' | while read ignore_string; do
ITEM_FOLDER=$(echo $ignore_string | awk '{print $2}' | cut -d'"' -f2)
ITEM_APP=$(echo $ignore_string | awk '{print $3}' | cut -d'"' -f2)
ITEM_FILE=$(echo $ignore_string | awk '{print $4}' | cut -d'"' -f2)
ITEM_NAME=$(echo $ignore_string | awk '{print $5}' | cut -d'"' -f2)
echo ''$ITEM_FOLDER' '$ITEM_APP' '$ITEM_FILE' '$ITEM_NAME' '
done > $NEW_FILE
}
add_custom_mxcr () {
TARGET_FILE=$1
CUSTOM_FILE=$2
cat $CUSTOM_FILE | grep '<item ' | while read ignore_string; do
ITEM_APP=$(echo $ignore_string | awk '{print $3}' | cut -d'"' -f2)
ITEM_FILE=$(echo $ignore_string | awk '{print $4}' | cut -d'"' -f2)
ITEM_NAME=$(echo $ignore_string | awk '{print $5}' | cut -d'"' -f2)
echo ''$ITEM_APP' '$ITEM_NAME' '$ITEM_FILE''
done >> $TARGET_FILE
}
if [ $# -gt 0 ]; then
case "$1" in
--parse_ignorelist)
parse_ignorelist_mxcr "$2" "$3";;
--add_custom)
add_custom_mxcr "$2" "$3";;
esac
fi