Loop through a set of HTML files and append text at top and bottom of each file
Posted
by NJTechGuy
on Stack Overflow
See other posts from Stack Overflow
or by NJTechGuy
Published on 2010-04-06T14:20:49Z
Indexed on
2010/04/06
14:23 UTC
Read the original article
Hit count: 186
shell-scripting
For instance, I have an HTML file like this :
a.htm
<body>
Hello world!
</body>
I want :
a.htm
<html>
<LINK href='style.css' rel=stylesheet type='text/css'>
<body>
Hello world!
</body>
</html>
The code I have so far is :
#!/bin/sh
for i in `ls *.htm`
do
@echo off
echo ***New top line*** > temp.txt
type i >> temp.txt
echo ***New bottom line*** >> temp.txt
move /y temp.txt i
done
Errors :
abc@bunny:~/fileAppendText$ ./loopAllFilesTest.sh
./loopAllFilesTest.sh: line 5: @echo: command not found
./loopAllFilesTest.sh: line 7: type: i: not found
./loopAllFilesTest.sh: line 9: move: command not found
./loopAllFilesTest.sh: line 5: @echo: command not found
./loopAllFilesTest.sh: line 7: type: i: not found
./loopAllFilesTest.sh: line 9: move: command not found
./loopAllFilesTest.sh: line 5: @echo: command not found
./loopAllFilesTest.sh: line 7: type: i: not found
./loopAllFilesTest.sh: line 9: move: command not found
Please help. Thanks!
© Stack Overflow or respective owner