
rauphel79
Novice
Sep 20, 2007, 3:46 AM
Post #1 of 1
(5299 views)
|
How to Convert to Perl from Shell ?
|
Can't Post
|
|
hi Gurus out there, I have the shell script below. Does someone know how to code in Perl.
for mFile in xaaa do # echo "Now working with file "$mFile" at "`date` mOutFile=$mFile".sql" while read mLine do _msisdn=$(echo $mLine | cut -d "|" -f 1) _cust_ic=$(echo $mLine | cut -d "|" -f 2) _cust_other_ic=$(echo $mLine | cut -d "|" -f 3) _cust_pass=$(echo $mLine | cut -d "|" -f 4) _cust_name=$(echo $mLine | cut -d "|" -f 5) _cust_street1=$(echo $mLine | cut -d "|" -f 6) _cust_street2=$(echo $mLine | cut -d "|" -f 7) _cust_post=$(echo $mLine | cut -d "|" -f 8) if [ -z "$_cust_ic" ] || [ -z "$_cust_other_ic"] || [-n "$_cust_pass"] ; then echo 'UPDATE customer SET cust_alt_fax="$_cust_pass",cust_name="$_cust_name",cust_street_1="$_cust_street1",cust_street_2="$_cust_street 2",cust_add_pcode="$_cust_post",chk_upd_dt=CURRENT WHERE cust_msisdn="$_msisdn";' >> $mOutFile elif [ -z "$_cust_other_ic" ] || [ -n "$_cust_other_ic" ] || [ -z "$_cust_pass"] ; then echo 'UPDATE customer SET cust_alt_fax="$_cust_other_ic",cust_name="$_cust_name",cust_street_1="$_cust_street1",cust_street_2="$_cust_st reet2",cust_add_pcode="$_cust_post",chk_upd_dt=CURRENT WHERE cust_msisdn="$_msisdn";' >> $mOutFile else echo 'UPDATE customer SET cust_alt_fax="$_cust_ic",cust_name="$_cust_name",cust_street_1="$_cust_street1",cust_street_2="$_cust_street2" ,cust_add_pcode="$_cust_post",chk_upd_dt=CURRENT WHERE cust_msisdn="$_msisdn";' >> $mOutFile fi done < $mFile done Please advise. Appreciate help.
|