Read file twice and modify content

  • Follow


Hello,
I want to modify content of multiple files.
Example file looks like this:
include("top.php");
..
..
..
include("menu[diffrent text in diffrent files]");

What I want to achive:
$menu = menu[diffrent text in diffrent files];
include("top.php);
..
..
..
#include("menu[diffrent text in diffrent files]");

Submitted via EggHeadCafe 
SharePoint 2010 Using External List
http://www.eggheadcafe.com/tutorials/aspnet/71ee360f-d781-48d6-8243-769d96b45064/sharepoint-2010-using-external-list.aspx
0
Reply zoozik (1) 3/16/2011 9:45:26 AM

Wed, 16 Mar 2011 09:45:26 +0000, Marek Podlesny did cat :

> Hello,
> I want to modify content of multiple files. Example file looks like
> this:
> include("top.php");
> .
> .
> .
> include("menu[diffrent text in diffrent files]");
> 
> What I want to achive:
> $menu = menu[diffrent text in diffrent files]; include("top.php);
> .
> .
> .
> #include("menu[diffrent text in diffrent files]");
> 
> Submitted via EggHeadCafe
> SharePoint 2010 Using External List
> http://www.eggheadcafe.com/tutorials/aspnet/71ee360f-d781-48d6-8243-769d96b45064/sharepoint-2010-using-external-list.aspx


not really sure of what you really want, this looks a lot like what you described
but maybe not what you meant :
----------
awk '
FNR==NR{f[n=NR]=$0; next}
NR==(1+n){sub(/^.[^\(]*\(./,"$menu = ",f[n]);sub(/\"/,"",f[n]);print f[n]}
FNR==n{sub(/^/,"#")}
1' file file
----------
0
Reply Loki 3/16/2011 5:40:03 PM


1 Replies
649 Views

(page loaded in 0.244 seconds)

Similiar Articles:













7/23/2012 10:10:42 AM


Reply: