I'm trying to take an HTML template and replace a few placeholders with a custom string.
I'm doing a curl of a template on github: str=$(curl https://raw.github.com/toneworm/template-html5-sass/master/index.html) saving the following to a variable:-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="[name]">
<meta name="author" content="">
<title>[name]</title>
<link type="text/css" rel="stylesheet" href="css/styles.css" />
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<!-- scripts -->
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
I want to do a global replace [name] with something else (TEST in this example)...
Currently I have sed -i 's/\[name\]/TEST/g' $first > index.html which throws the following error:-
sed: 1: "<!DOCTYPE": invalid command code <
Any ideas?