Bash Scripting: I want to open a set of .html files, and add line before html tag
Posted
by Bashn00b
on Stack Overflow
See other posts from Stack Overflow
or by Bashn00b
Published on 2010-03-19T10:10:22Z
Indexed on
2010/03/19
10:11 UTC
Read the original article
Hit count: 166
Hi guys, I have a set of .php files in a folder, I want to add text just before these lines:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
What i want is to insert just before these lines in the html file. So just want to prepend that file before each docType declaration. However the DOCTYPE declaration is never on line 1, as there is loads of php lines before.
I have this current script (where FE is the folder containing all the scripts i want to edit):
for file in ${fe}*; do
echo "$file"
done
Thanks,
© Stack Overflow or respective owner