Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-10-2012, 08:55 AM   PM User | #1
bmson
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bmson is an unknown quantity at this point
Makefile that user cat to load html and sed to replace

Hi,

Long time lurker but first time poster. I have a Makefile question and wasn't sure where to post the question but so I hope I picked the right category.

I'm working with backbone templates and have split my html in multiple files.
The index files includes this {template} text. I'm planing to use tha Makefile to load the text from multiple HTML files and replace the {template} variable with the content from those files.

My HTML files looks like this:

file.html
<div>
<a href='#'>my link</a>
</div>

index.html
<body>
{template}
</body>


Then I have a makefile that looks like such:

Makefile
include:
$(eval data := $(shell cat "file.html"))
sed -i '' 's/$({template})/$(data)/' index.html


The sed code works lika a charm and it replaces it with the data value if I force it to have text, but the cat breaks and gives me an 'Error 1'


I've tried both...
$(eval data := $(shell grep -nr file.html))
$(eval data := $(shell cat "file.html"))

They both fail when they reach <, >, ", ' or #.
I've not yet figured out how to load the html data into the variable.

So I'm looking for guidance from you guys and girl.
bmson is offline   Reply With Quote
Reply

Bookmarks

Tags
cat, grep, makefile, shell

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:37 AM.


Advertisement
Log in to turn off these ads.