Bonjour, à tous
je cherche qlq 1 qui maide à déchifrer ce scripts et m'aide à une documentation complet sur le shell scripts avec awk et ksh pour crée des scripts pas à pas par un null comme moi
merci à vous en avance ;voila le scripts
cat first_check.sh
cd ..
echo "\033[1m"
echo "Check Scratch existance using scnum in progress ....."
echo "\033[0m"
if test -f *.dat
then
i=1
for file in ./*.dat
do
lim1=`head -1 $file | awk -F"," '{print $4}' | awk -F"\"" '{print $2}'`
lim2=`tail -2 $file | head -1 | awk -F"," '{print $4}' | awk -F"\"" '{print $2}'`
if [ $i -eq 1 ]
then
let i=i+1
req="
set linesize 120
set pagesize 30
column min format a15
column max format a15
column profil format a9
column count format 999999
column interv format 999999
column used format 999999
column susp format 999999
column min_exp format a10
set colsep \" \"
define edg1=$lim1
define edg2=$lim2
select min(senum) min,max(senum) max,count(*) count,max(senum)-min(senum)+1 interv,
decode(key_scrp,'ECNQ500','DJ 500','02DZ1000','DJ 1200','04DZ2000','DJ 2300','01DZ3000','DJ 3000','09DZ100','DJ 100','10DZ200','DJ 200','05DZ500','AL 500','06AL1000','AL 1000','07AL100','AL 100','08AL200','AL 200','03XAL200','3xAL200','09AL500','AL 500 N',key_scrp) profil,
max(ascii(used_f)) used,max(ascii(susp_f)) susp,to_char(min(to_date(end_date,'dd/mm/yyyy')),'dd/mm/yyyy') min_exp,min(dynupdt)
from scratch1 a, scratchp b where scnum between '&edg1' and '&edg2' and scrpref=b.ri group by key_scrp,substr(senum,1,10);
exit;"
path="/in/oracle/bin/sqlplus dzasdpv1/dzasdpv1@PSMF.world"
path2="/in/oracle/bin/sqlplus dzasdpv2/dzasdpv2@SMF1.world"
echo "$req" | $path | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
echo "$req" | $path2 | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
else
req="
set linesize 120
set pagesize 0
column min format a15
column max format a15
column profil format a9
column count format 999999
column interv format 999999
column used format 999999
column susp format 999999
column min_exp format a10
set colsep \" \"
define edg1=$lim1
define edg2=$lim2
select min(senum) min,max(senum) max,count(*) count,max(senum)-min(senum)+1 interv,
decode(key_scrp,'ECNQ500','DJ 500','02DZ1000','DJ 1200','04DZ2000','DJ 2300','01DZ3000','DJ 3000','09DZ100','DJ 100','10DZ200','DJ 200','05DZ500','AL 500','06AL1000','AL 1000','07AL100','AL 100','08AL200','AL 200','03XAL200','3xAL200','09AL500','AL 500 N',key_scrp) profil,
max(ascii(used_f)) used,max(ascii(susp_f)) susp,to_char(min(to_date(end_date,'dd/mm/yyyy')),'dd/mm/yyyy') min_exp,min(dynupdt)
from scratch1 a, scratchp b where scnum between '&edg1' and '&edg2' and scrpref=b.ri group by key_scrp,substr(senum,1,10);
exit;"
path="/in/oracle/bin/sqlplus dzasdpv1/dzasdpv1@PSMF.world"
path2="/in/oracle/bin/sqlplus dzasdpv2/dzasdpv2@SMF1.world"
echo "$req" | $path | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
echo "$req" | $path2 | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
fi
done
else
echo "\033[1m"
echo "No Files ..."
echo "\033[0m"
fi
echo "\033[1m"
echo "Check Scratch existance using senum in progress ....."
echo "\033[0m"
if test -f *.dat
then
i=1
for file in ./*.dat
do
lim1=`head -1 $file | awk -F"," '{print $5}' | awk -F"\"" '{print $2}'`
lim2=`tail -2 $file | head -1 | awk -F"," '{print $5}' | awk -F"\"" '{print $2}'`
if [ $i -eq 1 ]
then
let i=i+1
req="
set linesize 120
set pagesize 30
column min format a15
column max format a15
column profil format a9
column count format 999999
column interv format 999999
column used format 999999
column susp format 999999
column min_exp format a10
set colsep \" \"
define edg1=$lim1
define edg2=$lim2
select min(senum) min,max(senum) max,count(*) count,max(senum)-min(senum)+1 interv,
decode(key_scrp,'ECNQ500','DJ 500','02DZ1000','DJ 1200','04DZ2000','DJ 2300','01DZ3000','DJ 3000','09DZ100','DJ 100','10DZ200','DJ 200','05DZ500','AL 500','06AL1000','AL 1000','07AL100','AL 100','08AL200','AL 200','03XAL200','3xAL200','09AL500','AL 500 N',key_scrp) profil,
max(ascii(used_f)) used,max(ascii(susp_f)) susp,to_char(min(to_date(end_date,'dd/mm/yyyy')),'dd/mm/yyyy') min_exp,min(dynupdt)
from scratch1 a, scratchp b where senum between '&edg1' and '&edg2' and scrpref=b.ri group by key_scrp,substr(senum,1,10);
exit;"
path="/in/oracle/bin/sqlplus dzasdpv1/dzasdpv1@PSMF.world"
path2="/in/oracle/bin/sqlplus dzasdpv2/dzasdpv2@SMF1.world"
echo "$req" | $path | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
echo "$req" | $path2 | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
else
req="
set linesize 120
set pagesize 0
column min format a15
column max format a15
column profil format a9
column count format 999999
column interv format 999999
column used format 999999
column susp format 999999
column min_exp format a10
set colsep \" \"
define edg1=$lim1
define edg2=$lim2
select min(senum) min,max(senum) max,count(*) count,max(senum)-min(senum)+1 interv,
decode(key_scrp,'ECNQ500','DJ 500','02DZ1000','DJ 1200','04DZ2000','DJ 2300','01DZ3000','DJ 3000','09DZ100','DJ 100','10DZ200','DJ 200','05DZ500','AL 500','06AL1000','AL 1000','07AL100','AL 100','08AL200','AL 200','03XAL200','3xAL200','09AL500','AL 500 N',key_scrp) profil,
max(ascii(used_f)) used,max(ascii(susp_f)) susp,to_char(min(to_date(end_date,'dd/mm/yyyy')),'dd/mm/yyyy') min_exp,min(dynupdt)
from scratch1 a, scratchp b where senum between '&edg1' and '&edg2' and scrpref=b.ri group by key_scrp,substr(senum,1,10);
exit;"
path="/in/oracle/bin/sqlplus dzasdpv1/dzasdpv1@PSMF.world"
path2="/in/oracle/bin/sqlplus dzasdpv2/dzasdpv2@SMF1.world"
echo "$req" | $path | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
echo "$req" | $path2 | awk '{if (/^no/) print "No Rows..."; else print $0}' | grep -vE "e|SQL|^$|No"
fi
done
else
echo "\033[1m"
echo "No Files ..."
echo "\033[0m"
fi
Configuration: Windows XP
Internet Explorer 7.0