Sujet : Re: How can I use sed to insert a character into a file?
De : fritz (at) *nospam* spamexpire-202407.rodent.frell.theremailer.net (Fritz Wuehler)
Groupes : comp.os.linux.miscDate : 09. Jul 2024, 16:26:11
Autres entêtes
Organisation : dizum.com - The Internet Problem Provider
Message-ID : <0e5c2fc463ca61baeed61bb8340a9658@msgid.frell.theremailer.net>
References : 1
Jon Danniken <
nones...@nottodaynortomorroreither.org> [JD]:
JD> <type:color>000000</type:color>
JS> <type:color>FFFFFF</type:color>
JD> the tags are hex colors ... but need to begin with a pound sign (#)
# append a pound sign after the first instance of ">"
< file sed 's@>@&#@'
Or, if you are a fan of 'awk'
# replace the first instance of ">" with ">#" and print the line
< file awk '{sub(">",">#")}1'