ODFHIGHLIGHT(1p)

πŸ“¦
version 2.125 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– 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: #00ff00 for green πŸ’š
    • or, if a colormap is available and known in your OpenOffice::OODoc installation, a symbolic color name β€” ex: "sky blue" 🌈
  • -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