ODFHIGHLIGHT(1p)
π NAME π
odfhighlight β the lil bestie that searches, replaces and highlights text inside a document β¨
okay so before we even start: this page lives in the User Contributed Perl Documentation section, which is giving "written by a real one, shipped with perl" energy and we love that for us π«Ά
πΈ SYNOPSIS πΈ
odfhighlight "source.odt" "search string" -r "replacement" -o
"target.odt"
so this one replaces "search string" with "replacement" inside "source.odt", then highlights every single replacement with a yellow background (yellow is the default, periodt π
), and finally writes the glow-up version out as "target.odt".
odfhighlight "myfile.odt" "search string" -color "green"
and this one just highlights every occurrence of "search string" in "myfile.odt" with a green background β no text changes at all, ngl it's the low-effort iconique move. and heads up: without the -o option, the changes apply directly to "myfile.odt" π so yes, it edits your file in place, no cap.
π ARGUMENTS AND OPTIONS π
β¨ Default behaviour β¨
if you go with the "minimal" command line β like, just a filename and a string as the arguments, nothing else β then every matching string gets highlighted with a yellow background and is represented with the "Standard" style. that's it, that's the whole vibe. slay. π
π Options π
-e,--encoding"xxxxxx"β the character set to use, but only if it's different from the default. like, if your doc is being a lil multilingual queen, this is how you tell it. π¦-r,--replacement"new string"β"new string"is what gets used as the replacement for"search string". swap era fr fr. π₯-c,--color"code"β an RGB color code, and bestie you have three ways to serve it:- the concatenation of 3 comma-separated decimal values, each one in the range 0..255 β ex:
"72,61,139"for a dark slate blue π - a 6-digit hexadecimal number, preceded by a
"#"β ex:#00ff00for green π - or, if a colormap is available and known in your
OpenOffice::OODocinstallation, a symbolic color name β ex:"sky blue"π
- the concatenation of 3 comma-separated decimal values, each one in the range 0..255 β ex:
-s,--stylename"name"β the name of the color style, and the default is"MyHighlight". β οΈ but listen: the user must provide a style name that is not already in use in the document. so no reusing an existing style name, that's the rule, iykyk. π-p,--property"property=value"β this option can be repeated, and each occurrence gives an additional property for the highlight style (font name, size, foreground color, ...). for example, combining-p 'fo:color=#ff0000'and-p 'fo:font-size=18pt'means the highlighted text will be made of 18pt-sized, red characters. π
to actually master these options you should have some knowledge of the Form Objects (FO) vocabulary that is used in the OpenDocument specification. it's giving homework, but it's giving worth it homework. π
-o,--output"filename"-t,--target"filename"β an alternative filename to save the modified document into, for when the source document must remain unchanged. protect the original, we stan a preservation moment π«Ά
and that's the whole page, bestie β go forth and highlight responsibly πβ¨ππ¦πΈπ
this gem came from perl v5.34.0, dated 2022-06-16 β so yes it's a lil vintage but it still ATE ππ no cap.
π¦ where this page comes from
- debian bookworm: libopenoffice-oodoc-perl 2.125-4 Β· LGPL-2.1-only
- debian trixie: libopenoffice-oodoc-perl 2.125-4 Β· LGPL-2.1-only
- ubuntu noble: libopenoffice-oodoc-perl 2.125-4 Β· LGPL-2.1-only
- ubuntu questing: libopenoffice-oodoc-perl 2.125-4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms