Howto insert string. (Was: Re: [freebsd-questions] awk quickie.)
Garrett Cooper
youshi10 at u.washington.edu
Mon Aug 7 17:47:50 UTC 2006
Kurt Wall wrote:
> On Mon, Aug 07, 2006 at 07:13:03AM -0400, Kurt Wall wrote:
>
>> On Sun, Aug 06, 2006 at 03:47:32PM -0700, Gary Kline wrote:
>>
>>> I've got 80 or so html/php files. Most do have
>>>
>>> <BODY BGCOLOR=#FFFFFF">
>>>
>>> but a whole slew do not/are missing the BG color code.
>>> So is there some scripto-magic way of finding out which fles are
>>> missing the above string? I know how, using an ed/ex script to
>>> insert this string.
>>>
>> I'd probably do "grep -vi bgcolor filename"
>>
>
> [bad form to reply to my own post, etc.]
>
> Doh! You want to *insert* the string, not (just) find the ones that
> don't have it. My ed/ex chops blow, so with sed:
>
> sed -i '' 's/<BODY>/<BODY BGCOLOR="#FFFFFF">/' file_name
>
> Kurt
You may just want to use CSS as well instead of hardcoding in HTML
values like that. The background-color property is pretty much common
and universal in all browsers, since CSS 1.0(/1.1?).
-Garrett
More information about the freebsd-questions
mailing list