Hi

Thanx for ur replies and coming to the topic actually i am working this out in LINUX and here we are using it temporarily for a file which has around 100 include statements and again in each inlcude file there may be around 1 to 10 ranging depinding on the type of device rules file. So here its just parent and a Child level ......

Firstly we want to test it our for at leat 2 to 3 levels of includes within include files. Coming to the fastness as you said it not a big problem about it will be OK if it takes adequate amount of time.

i shall also jus give out a sample code which is presently backing up the files which are not having any inlcude statements and also recursively searching for the inlcude into the Depth........

#!/usr/bin/perl use strict; my $first_path = "/opt/netcool/etc/test.rules"; &srch_include($first_path); my ($incl_full_path , $dir_path, $file_name) ; sub srch_include { my ($main_path) = @_ ; print " First Sub Path : $main_path \n"; open( FH1, "$main_path") or die " Sub1 Error: $! \n "; my @main_file_cont = <FH1>; my $count = 0; foreach my $main_file_line ( @main_file_cont ) { if( $main_file_line =~ /^(\s+)?include\s+"(.*)"$/) { my $count++; $incl_full_path = $2 ; print " Inlcudes :: $incl_full_path \n "; $incl_full_path =~ /(.*\/)(.*)/; $dir_path = $1 ; $file_name = $2; print " Dir : $dir_path File : $file_name \n "; system ("mkdir -p /root/msk/$dir_path"); sleep 2 ; open(CR, ">/root/msk/$incl_full_path") or die " Main + File Error: $! \n"; print CR " @main_file_cont "; close(CR); &srch_include($incl_full_path); } } if($count == 0 ) { #print " $incl_full_path has No includes and lookup \n "; $incl_full_path =~ /(.*\/)(.*)/; $dir_path = $1 ; $file_name = $2; #print " Dir : $dir_path File : $file_name \n " system ("mkdir -p /root/msk/$dir_path"); sleep 2 ; open(CR, ">/root/msk/$incl_full_path") or die " No Includ +e Error: $! \n"; print CR " @main_file_cont "; close(CR); } }
here i am able to back the files with no inlcude statements and also the files which has inlcudes i am backing up the main file too and then searching and gooing into the depth . So jus check ot out and i shall be waiting for ur replies and thank you very much for ur help....
Work Hard Party Harderrr!!
Sushil Kumar

In reply to Re^2: Includes within includes by msk_0984
in thread Includes within includes by msk_0984

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.