#!/bin/sh
ls -l *.xml|nl|awk '{print ""$10","$1",\x27"$10"\x27"}' > xml_files.dat
sqlldr username/password(for database)@localhost:1521/xe control='xml.ctl'
sqlplus -s username/password(for database)@localhost:1521/xe<<END
execute xml_dataloader_p
delete from xml_files where file_name is not null;
Commit;
exit;
END
>xml_files.dat
ls -l ----> To display all directories.
nl ----> To display line numbers.
awk ----> awk formating text in required format in a file.
$10 ----> 10 th column of response from " ls -l *.xml |nl "
[karunan@eappnodejs anand]$ ls -l *.xml|nl
1 -rw-rw-r--. 1 karunan karunan 8747 Jun 12 15:0noshipment1_2017_03_30_02_55_18_013.xml
count of above line like 1 for 1st and .xml file name is 10th
$1 ---> sequence
\x27 ---> To display single code " ' "
http://www.unix.com/shell-programming-and-scripting/130984-how-call-oracle-stored-procedure-unix-shell.html
ls -l *.xml|nl|awk '{print ""$10","$1",\x27"$10"\x27"}' > xml_files.dat
sqlldr username/password(for database)@localhost:1521/xe control='xml.ctl'
sqlplus -s username/password(for database)@localhost:1521/xe<<END
execute xml_dataloader_p
delete from xml_files where file_name is not null;
Commit;
exit;
END
>xml_files.dat
ls -l ----> To display all directories.
nl ----> To display line numbers.
awk ----> awk formating text in required format in a file.
$10 ----> 10 th column of response from " ls -l *.xml |nl "
[karunan@eappnodejs anand]$ ls -l *.xml|nl
1 -rw-rw-r--. 1 karunan karunan 8747 Jun 12 15:0noshipment1_2017_03_30_02_55_18_013.xml
count of above line like 1 for 1st and .xml file name is 10th
$1 ---> sequence
\x27 ---> To display single code " ' "
http://www.unix.com/shell-programming-and-scripting/130984-how-call-oracle-stored-procedure-unix-shell.html
Downloading ldts through script :
#!/bin/sh
while read -r line;
do
FNDLOAD sqlusername/password O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct $line.ldt PROGRAM APPLICATION_SHORT_NAME="XXXX" CONCURRENT_PROGRAM_NAME="$line"
mv *.ldt /home/oracle/sampleldts/ldts
mv *.log /home/oracle/sampleldts/logs
done < file.txt
while read -r line;
do
FNDLOAD sqlusername/password O Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct $line.ldt PROGRAM APPLICATION_SHORT_NAME="XXXX" CONCURRENT_PROGRAM_NAME="$line"
mv *.ldt /home/oracle/sampleldts/ldts
mv *.log /home/oracle/sampleldts/logs
done < file.txt
No comments:
Post a Comment