SPUG: modify the include files depending up on instructions in it

DeRykus, Charles E charles.e.derykus at boeing.com
Thu Mar 17 05:46:44 PST 2005


Here's a possibility:

--
Charles DeRykus

perl -nli.bak -e '($f)=m{.*/([^"]+)}; print <<END
> #ifdef SYM
> #include "\$INCLUDE_DIR/$f"
> #else
> #include "../$f"
> #endif
> END
> ' include.cfg


input:
     #include "../comm.cfg"
     #include "../ext.frg"

output:
    #ifdef SYM
    #include "$INCLUDE_DIR/comm.cfg"
    #else
    #include "../comm.cfg"
    #endif

    #ifdef SYM
    #include "$INCLUDE_DIR/ext.frg"
    #else
    #include "../ext.frg"
    #endif

-----Original Message-----
From: Sachin Chaturvedi [mailto:sachin_chat at coolgoose.com] 
Sent: Wednesday, March 16, 2005 11:28 PM
To: spug-list at mail.pm.org
Subject: SPUG: modify the include files depending up on instructions in it 


i am having a file in all directories names as include.cfg inside this file i am havinf a number of include statements like #include "../comm.cfg" #include "../ext.frg" #include "../mem.cmd" i have changed my script, which uses this file in such a way that i need to modify my file so that now it looks like this

#ifdef SYM
#include "$INCLUDE_DIR/ext.frg"
#else
#include "../include/ext.frg"
#endif
#ifdef SYM
#include "$INCLUDE_DIR/mem.cmd"
#else
#include "../include/mem.cmd"
#endif
this code is to be added for each include statements in the file. can any one help me with this how can i do. i am not a expert 
of perl, just learning things. 
_____________________________________________________________
Seattle Perl Users Group Mailing List  
     POST TO: spug-list at pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
    MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
    WEB PAGE: http://seattleperl.org/


More information about the spug-list mailing list