⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isnreport

📁 一个awk和bsh混合编程的例子
💻
字号:
#!/bin/ksh#$Id: @(#) isnreport@@/main/ISN_R510_N81/ISN_R511_NR81_PL1/1  2007-02-07 09:35:23 GMT  delia $echo "Procedure: `basename $0`"################################################################################                         Variables settings################################################################################set -x. `dirname $0`/../etc/env_def_isn# DB-upload request scripts.# Posts a request for a report to the 1354RM calling the correct executablefileName=$1className=$2attrIdList=$3backComp="{}";VERSION=$5REPORT_ID=$6COMPATIBLE_MAP="./data/CompatibleMap.cfg";VERSION_TMP=${VERSION#*\{};VERSION=${VERSION_TMP%*\}};CONFIG_FILE_NAME="./data/Rep_$VERSION.cfg";. `dirname $0`/../env/env_var_agt. ~/.profile. $SYS_HOME/.snmlrc# Export some evironment variable needed for RM opinvexeexport NAV_PORT_NUMBER=1export ApplicationTraceFile=/tmp/ApplicationTraceFile.logdelRedundance(){	if [ -z "$VERSION" ]; then   		echo "ERROR: version is not specified.";   		exit 1;	fi   	if [ -z "$REPORT_ID" ]; then		echo "ERROR: report_id is not specified.";		exit 1;	fi		if [ ! -r $CONFIG_FILE_NAME ]; then		echo "ERROR: $CONFIG_FILE_NAME not exist.";		exit 1;	fi		Obj_Deleted=`awk -F":" '			BEGIN {deleted=0;}		/^ *\t* *#.*/ {;}		/^ *\t* *$/ {;}		/^[0-9]*/ {			if ($1==id ){				if (length($3)==0 ){					deleted=1;				}			}		}		END {printf "%d\n",deleted;}' id=$REPORT_ID $CONFIG_FILE_NAME`;		if [ $Obj_Deleted -eq 0 ]; then	{		Attr_Names=`awk -F":" '		/^ *\t* *#.*/ {;}		/^ *\t* *$/ {;}		/^[0-9]*/ {			if ($1==id ){					printf "%s\n",$3;			}		}' id=$REPORT_ID $CONFIG_FILE_NAME`;	}	fi		attrIdList_BAK=$attrIdList;	attrIdList_BAK_TMP=${attrIdList_BAK#*\{};	attrIdList_BAK=${attrIdList_BAK_TMP%*\}};		attr_orig_array=`echo $attrIdList_BAK|awk -F":" '{		for (ix=1; ix <=NF; ix+=1){			printf "%s\n", $ix;		}	}'`;		attrs_String="";	for elem in $attr_orig_array 	do		found=0;		for attr in $Attr_Names 		do			if [ "$attr" = "$elem" ]; then				found=1;				break;			fi		done		if [ found -eq 0 ]; then			attrs_String=$attrs_String":"$elem;		fi	done	attrIdList_TMP=${attrs_String#*:};	attrIdList="{"$attrIdList_TMP"}";}fetchRMVer(){	if [ ! -r $COMPATIBLE_MAP ]; then		echo "ERROR: $COMPATIBLE_MAP not exist.";		exit 1;	fi		backComp=`awk '		/^ *\t* *#.*$/ {;}		/^ *\t* *$/ {;}		/^V/ {			version_map[$1] = $2;		}		END {			printf "%s\n", version_map[isn_version];		}' isn_version="$VERSION" $COMPATIBLE_MAP`;	backComp="{"$backComp"}";}if [ "$4" = "{}" ]; then  if [ "$5" = "{}" ]; then   $SYS_HOME/bin/opinvexe.exe -file $fileName                  \                               -class $className                \                               -attribute_list $attrIdList      \                               -separator_ch ':'                \                               -escape_ch '\'                   \                               -nesting_indicator_open_ch '{'   \                               -nesting_indicator_close_ch '}'  \                               -char_to_escape '[]{}=:\'  else   delRedundance;   fetchRMVer;   $SYS_HOME/bin/opinvexe.exe -file $fileName                  \                               -class $className                \                               -attribute_list $attrIdList      \                               -separator_ch ':'                \                               -escape_ch '\'                   \                               -nesting_indicator_open_ch '{'   \                               -nesting_indicator_close_ch '}'  \                               -char_to_escape '[]{}=:\'        \                               -back_comp $backComp  fi   echo "EXIT="$?else# # Manage also ALIAS value in filter 26/11/2002#       AREA=`dirname $0`    filterIn=$4    elab_filter=`echo $filterIn | sed -e s"/\"//g" | sed -e s"/{//g" | sed -e s"/}//g"`        echo $elab_filter | tr "[:]" "[\012]" | grep -v "^AND" | grep -v "^OR" > /tmp/flt_$className.tmp    to=""    while read flt; do      to=`grep "$flt[ ]" $AREA/Alias2Enum | awk '{print $NF}'`      if [ "$to" ]; then        from=`echo $flt | cut -d"=" -f2`        filterTmp=`echo $filterIn | sed -e s"/=$from/=$to/g"`        filterIn=$filterTmp        to=""      fi    done < /tmp/flt_$className.tmp    rm /tmp/flt_$className.tmp    #techFilter=`echo $filterIn | sed -e s"/\"//g"`    techFilter=$filterIn##   attrIdList_str="'"$attrIdList"'"  if [ "$5" = "{}" ]; then   echo "$SYS_HOME/bin/opinvexe.exe -file $fileName            \			      -class $className                \			      -attribute_list $attrIdList_str  \                              -filter $techFilter              \                              -separator_ch ':'                \                              -escape_ch '\'                   \                              -nesting_indicator_open_ch '{'   \                              -nesting_indicator_close_ch '}'  \                              -char_to_escape '[]{}=:\'        " | /bin/ksh  else   delRedundance;   fetchRMVer;   attrIdList_str="'"$attrIdList"'"   echo "$SYS_HOME/bin/opinvexe.exe -file $fileName            \			      -class $className                \			      -attribute_list $attrIdList_str  \                              -filter $techFilter              \                              -separator_ch ':'                \                              -escape_ch '\'                   \                              -nesting_indicator_open_ch '{'   \                              -nesting_indicator_close_ch '}'  \                              -char_to_escape '[]{}=:\'        \                              -back_comp $backComp         " | /bin/ksh  fi    echo "EXIT="$?fi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -