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

📄 builddata.sh

📁 一个应用awk填充所需数据文件的shell例子
💻 SH
字号:
trap "" 1 2

#
#	Copyright (c) 2001*2003 ADTEC Ltd.
#	All rights reserved
#
#	This is unpublished proprietary source code of ADTEC Ltd.
#	The copyright notice above does not evidence any actual
#	or intended publication of such source code.
#
#	NOTICE: UNAUTHORIZED DISTRIBUTION, ADAPTATION OR USE MAY BE
#	SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
#
#	ProgramName : adlfunc.c
#	Language	: sh 
#	OS & Env	: HP*UX
#	Description : 社保生成基础参数数据
#	History	 :
#	YYYY/MM/DD   Position	  Author		Description
#	-----------------------------------------------------------
#	2008/11/26   Beijing	   lichao		Creation

build()
{
	clear
	echo "
 ***************************************************
 **                                               **
 *               生成社保标准参数                  *
 **                                               **
 *               1.生成t_entr_brch.dat             *
 **                                               **
 *               2.生成t_entr_con.dat              *
 **                                               **
 *               3.生成t_busi_open.dat             *
 **                                               **
 *               4.生成t_oper.dat                  *
 **                                               **
 *               5.生成t_teller.dat                *
 **                                               **
 *               6.预留                            *
 **                                               **
 *               0.退出                            *
 **                                               **
 ***************************************************

请输入您的选择: \c"
	read char
	case $char in
		1) echo "生成t_entr_brch.dat..."
		rm t_entr_brch_tmp.dat
		echo "请输入列表文件(默认为t_entr_brch.lis):\c"
		read filename
		if [ "x$filename" = "x" ]
			then BUILDFILE=`cat t_entr_brch.lis|sed -e 's/#.*//g'`
		else
			BUILDFILE=`cat $filename|sed -e 's/#.*//g'`
		fi
		for file in $BUILDFILE
		do
			awk -F "	" '
			{
				#if( FNR > 2 )
				printf("%s|%s|%s|%s||%s|||||||\n","010201",$2,$4,$5,substr($3,1,1) );	
			}' $file >> t_entr_brch_tmp.dat
		done
		echo "生成成功,按任意键返回"
		read char
		build
		;;
		2) echo "生成t_entr_con.dat..."
		rm t_entr_con_tmp.dat
		echo "请输入列表文件(默认为t_entr_brch.lis):\c"
		read filename
		if [ "x$filename" = "x" ]
			then BUILDFILE=`cat t_entr_brch.lis|sed -e 's/#.*//g'`
		else
			BUILDFILE=`cat $filename|sed -e 's/#.*//g'`
		fi
		for file in $BUILDFILE
		do
			awk -F "	" '
			{
				#if( FNR > 2 )
				printf("%s|%s||||||||||||||\n","010201",$4);
			}' $file >> t_entr_con_tmp.dat
		done
		echo "生成成功,按任意键返回"
		read char
		build
		;;
		3) echo "生成t_busi_open_tmp.dat..."
		rm t_busi_open_tmp.dat
		echo "请输入列表文件(默认为t_busi_open.lis):\c"
		read filename
		if [ "x$filename" = "x" ]
			then BUILDFILE=`cat t_busi_open.lis|sed -e 's/#.*//g'`
		else
			BUILDFILE=`cat $filename|sed -e 's/#.*//g'`
		fi
		for file in $BUILDFILE
		do
			awk -F "	" ' {
				split($4,TMP,":");
				TMP1="010201";
				TMP2=substr($2,1,9);
				printf("%s|%s|%s|%s|%s|%s||%s|||||||||||||||||||||||||\n",TMP2,TMP1,TMP[1],$2,$5,$5,$5);			
			}' $file >> t_busi_open_tmp.dat
		done
		echo "生成成功,按任意键返回"
		read char
		build
		;;
		4) echo "生成t_oper_tmp.dat..."
		rm t_oper_tmp.dat
		echo "请输入列表文件(默认为t_oper.lis):\c"
		read filename
		if [ "x$filename" = "x" ]
			then BUILDFILE=`cat t_oper.lis|sed -e 's/#.*//g'`
		else
			BUILDFILE=`cat $filename|sed -e 's/#.*//g'`
		fi
		for file in $BUILDFILE
		do
			awk -F "," '
			{
				#if( FNR > 2 )
				if( substr($4,1,1) == 4 )
					role_name="社保分行系统管理员"
				if( substr($4,1,1) == 5 )
					role_name="社保分行操作员"
				if( substr($4,1,1) == 6 )
					role_name="社保分行业务管理员"
				if( substr($4,1,1) == 7 )
					role_name="社保网点系统管理员"
				if( substr($4,1,1) == 8 )
					role_name="社保网点操作员"
				printf("%s|%s|%s||%s|%s|%s|%s|%s|%s|%s|||||||||%s||||||\n",$1,$2,"123456","0","1",role_name,substr($4,1,1),"0","0",$3,"root" );
			}' $file >> t_oper_tmp.dat
		done
		echo "生成成功,按任意键返回"
		read char
		build
		;;
		5)
        rm t_teller_tmp.dat
        echo "请输入列表文件(默认为t_oper.lis):\c"
        read filename
        if [ "x$filename" = "x" ]
            then BUILDFILE=`cat t_teller.lis|sed -e 's/#.*//g'`
        else
            BUILDFILE=`cat $filename|sed -e 's/#.*//g'`
        fi
        for file in $BUILDFILE
        do
            awk -F "|" '
            {
				i=1;
				split( "UA9:UB0:UB1:UB2:UB3",tmp1,":");
				split( "109:110:111:112:113",tmp2,":");
				for(i=1;i<6;i++)
				{
        			printf( "%s%s|%s|%s%s|N|Y|||Y|0|||U|%s||||||||||\n",$1,tmp1[i],$1,"虚柜",i,tmp2[i] );
				}
            }' $file > t_teller_tmp.dat
        done
        echo "生成成功,按任意键返回"
        read char
        build
		;;
		6)
		build
		;;
		0)
		;;
		*) build
		;;
	esac
}
build

⌨️ 快捷键说明

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