我正在尝试以表格格式格式化我的脚本输出:
Data: 11001,4071 | 10008,4578 | 10500,2100 ...
==================================================
20160720 55454 545454 55454
不知怎的,我能够实现它,但脚本要求输入密码并打印catrunner --> Using standard unix daf factory libpal-daf inline.
像:
Date: 11001,4071 | 10008,4578 | 10500,2100 | 40000,4021 | 10003,1102 | 11001,9230 | 10001,1001 | 40000,4020 | 10001,1102 | 10008,4569 | 10008,4568 | 10003,1200 | 40000,4006
======================================================================================================================================================================================
20160720 Password: // for switch user, how can i ommit password request?
su: incorrect password
catrunner --> Using standard unix daf factory libpal-daf //How can i get ride of this line?
13116
catrunner --> Using standard unix daf factory libpal-daf
9167
catrunner --> Using standard unix daf factory libpal-daf
这是我的剧本:
#!/bin/bash
clear
DT=`date +%Y%m%d`
Yesterday=$(date --date="-1 day" +"%Y-%m-%d")
CODES="$(< error_codes.txt)"
divider==============
divider1=$divider$divider$divider$divider$divider$divider$divider$divider$divider$divider$divider$divider$divider$divider
header="\n %-10s %8s %10s %21s\n"
width=43
echo " Date: " `sed -e :a -e '$!N; s/\n/ | /; ta' error_codes.txt`
echo $divider1;
printf "%s\t" $DT
su - adv
cd /advdata/datashareB/FFFF/continuousDownstream/` echo $Yesterday`
for CODE in $CODES; do
EventType=$(echo $CODE | cut -c1-5)
ErrorCode=$(echo $CODE | cut -c7-10)
eventExport -printEvents -file Run_`echo $fileName`*_*.tar -filter "ErrorCode=`echo $ErrorCode`;EventType=`echo $EventType`" -names -silent | wc -l
done
printf "$s\n"