Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v6hfg4$103fh$1@dont-email.me>
Deutsch   English   Français   Italiano  
<v6hfg4$103fh$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nuno Silva <nunojsilva@invalid.invalid>
Newsgroups: comp.os.linux.misc
Subject: Re: How can I use sed to insert a character into a file?
Date: Mon, 08 Jul 2024 20:43:00 +0100
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <v6hfg4$103fh$1@dont-email.me>
References: <v6hc36$vv1m$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 08 Jul 2024 21:43:00 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2bb0366cb8d58357519f9a4388f8a5be";
	logging-data="1052145"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+rAM8CFurN9qH5DibIeh00"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
Cancel-Lock: sha1:C5kzoP6l9YSapFSZsSJdJxrPgtw=
Bytes: 2220

On 2024-07-08, Jon Danniken wrote:

> I'm sure this is trivial to most here, but sed confounds me.  I have
> an xml file with content following this format:
>
> <type:color>000000</type:color>
> <type:color>FFFFFF</type:color>
>
> The information within the tags are hex colors (many different
> colors), but they need to begin with a pound sign (#) to work in a
> particular application, ie:
>
> <type:color>#000000</type:color>
> <type:color>#FFFFFF</type:color>
>
> How can I use sed to append the pound symbol in this file? Using sed
> 4.8 BTW, thanks!

in general, my guess would be something like (for sed's s command)

    s@\(<type:color>\)\(......\)\(</type:color>\)@\1#\2\3@g

Other approaches will surely be possible, say, if these are the only
sequences of hex digits that show up, or if this always appears on a
line by itself (so maybe matching lines on <type:color> and then
replacing the sequence of digits with #& could be done too - & being the
matched text)

Treat this like it had been written on a napkin over my knee, I may have
made a stupid mistake above or overlooked something obvious, surely
others will chime in with better suggestions. There's also
comp.unix.programmers, and I think also a shell group, which might be
helpful audiences too.

-- 
Nuno Silva