Record split Shell

Source: Internet
Author: User

If [-z "$1"]; then
Echo "You did not enter the parameters for executing the shell"
Exit;
Fi

If ["$1 "! = "JF"] & ["$1 "! = "Token"]; then
Echo "enter the name of the server to be uploaded: JF score, audit by region"
Exit;
Fi
Cur_year = 'date + "% Y "'

Month = $ (Date "+ % m" | sed '/^ 0/S/0 //')
Permonth = 'expr $ month-1'
Month_len = 'expr length $ permonth'
If ["$ month_len" = "1"]; then
V_month = 0 $ permonth
Elif ["$ month_len" = "2"]; then
V_month = $ permonth
Elif ["$ permonth" = "0"]; then
V_month = '12'
Fi

Lastmonth =$ {cur_year }$ {v_month}
# Lastmonth = 201202
# V_month = "02"
Value = 'sqlplus-s chanxxxlzb/xxxx @ chzzz <EOF
Set heading off;
Set feedback off;
Set pagesize 0;
Set verify off;
Set echo off;
Select count (*) from B _info_clear_owe where acct_month = '$ {lastmonth }';
Exit;
EOF'
Echo "**************************";
Echo $ value;
Echo "**************************";

Begin = 1;
End = 1000000;
File_seq = 1;

Temp = 'expr $ value \ % 100'
Echo $ temp

Temp1 = 'expr $ value/808080'

If [$ temp-GT 0]; then
Temp1 = 'expr $ temp1 + 1'
Fi

While [$ file_seq-Le $ temp1]
Do
Echo "File $ {file_seq"
Strfile_seq_1 = 'printf "% 03d \ n" $ temp1'
Strfile_seq_2 = 'printf "% 03d \ n" $ file_seq'
Strfile_seq =$ {strfile_seq_1 }$ {strfile_seq_2}
Echo $ {strfile_seq }$ {begin }$ {end}
If ["$1" = "JF"]; then
Exp_month_jf execsql exp_month_clear_owe file_seq $ {strfile_seq} begin $ {begin} end $ {end}
Elif ["$1" = "Hangzhou"]; then
Exp_month_1_execsql exp_month_clear_owe file_seq $ {strfile_seq} begin $ {begin} end $ {end}
Fi
Sleep 1
Begin = 'expr $ begin + 1000000'
End = 'expr $ end + 100'
File_seq = 'expr $ file_seq + 1'
Strfile_seq = "";
Done

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.