in reply to extract content for nested pattern in a file

> please explain in simple way

Can't be simpler! Just write a parser for the input format.

#!/usr/bin/perl # http://perlmonks.org/?node_id=1173242 use strict; use warnings; my @header; while(<DATA>) { local $" = ':'; 1 while /\G\s*(\w+)\)/gc ? push @header, $1 : # name) /\G\s*(\w+=\S+)/gc ? print "@header: $1\n" : # parameter=value /\G\s*;;/gc && (pop @header, @header || print "\n"); # end } __DATA__ 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 ;;