input.txt abhi) old_file="ak.csv" datefile="ak_nt_$curr_date.csv" cat /aksin/nil; cat /home/null case `kumar` in dbk) newwack="rac_client_$curr_date.ack" IN_DIR="class/5060" ;; src) src_folder="class/5061 ;; esac echo "$date_file" ;; bill)old_file="abh_cash.csv" date_file="ods_nt_cash_acc_$curr_date.csv" newwack="rac_cash_acc_$curr_date.ack" IN_DIR="xyx\5060" ;; payu) old_file="ods_ven.csv" newfile="ods_nt_ven_$curr_date.csv" newwack="rac_vendor_$curr_date.ack" IN_DIR="ofc\5060" case para in bcc) newreck="client_$curr_simul.ack" IN_DIR="class/5062" ;; src1) src_folder="class/5061 ;; esac ;; ########################## #### OUTPUT should be : abhi: old_file="ak.csv" abhi: datefile="ak_nt_$curr_date.csv" abhi:dbk: newwack="rac_client_$curr_date.ack" abhi:dbk: IN_DIR="class/5060" abhi:src: src_folder="class/5061 bill: old_file="abh_cash.csv" bill: date_file="ods_nt_cash_acc_$curr_date.csv" bill: newwack="rac_cash_acc_$curr_date.ack" bill: IN_DIR="xyx\5060" payu: old_file="ods_ven.csv" payu: newfile="ods_nt_ven_$curr_date.csv" payu: newwack="rac_vendor_$curr_date.ack" payu: IN_DIR="gunda\5060" payu:bcc: newreck="client_$curr_simul.ack" payu:bcc: IN_DIR="class/5062" payu:src1: src_folder="class/5061 #### open (data, ") { s/^\s+//g; #LTRIM if (/"(.*)"\)(.*)$/) { #pattern match $parameter = $1; $var = $2 . "\n"; } else { $var = $_; } if (/case/../esac/){ if (/"(.*)"\)(.*)$/) { $parameter ="$parameter:$1"; $var = $2 . "\n"; } } if (/;;/) { print "\n"; next; } if($var=~/^\s*$/) {next;} #if $var is empty or 1 or more than 1 whitespaces. elsif ($var!~/=/) {next;} #ignore if $var does not consist "=" sign else{ print "$parameter: $var"; } } close data;