1#!/bin/sh
2CLASS_NAME_FILE="/tmp/app_class.txt"
3f_file=$1
4cur_class=""
5cur_class_file=""
6test -z "$f_file" && return
7test -d /tmp/appfilter && rm /tmp/appfilter -fr
8
9mkdir /tmp/appfilter
10rm $CLASS_NAME_FILE
11while read line
12do
13    echo "$line"| grep "^#class"
14    if [ $? -eq 0 ];then
15        class=`echo $line| grep '#class' | awk '{print $2}'`
16	if ! test -z "$class";then
17		cur_class=$class
18		cur_class_file="/tmp/appfilter/${cur_class}.class"
19		if [ -e "$cur_class_file" ];then
20			rm $cur_class_file 
21		fi
22		touch $cur_class_file
23		echo $line |  awk '{print $3 " " $2 " "$4}' >>$CLASS_NAME_FILE
24	fi
25	continue
26    fi
27    test -z "$cur_class" && continue
28    appid=`echo "$line" |awk '{print $1}'`
29    appname=`echo "$line" | awk '{print $2}' | awk -F: '{print $1}'`
30    echo "$appid $appname" >> $cur_class_file
31done  < $f_file
32