html

A Scala shell script to insert text before a matching pattern

I don’t remember exactly why I wrote this Scala shell script, but if I remember right I was having a problem getting sed to work properly, so I wrote this little script to insert an Amazon Kindle “break” tag before each <h1> tag in an HTML file:

This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.

A Scala “Word of the day” shell script

I have a 19" monitor on the counter between my kitchen and living room, and it’s powered by a Raspberry Pi. I use the Linux Phosphor screen saver to show a scrolling “news and stock ticker” on the display, which I’ve programmed to show news from several different sources (Atom and Rss feeds, along with other news and data sources). An old version of the display looks like this:

My Raspberry Pi news ticker display

Today I added a new “Word of the day” feature to the display, and as with all of the other code, I wrote a Scala shell script to generate the output.

This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.

Examples of converting HTML to plain text with Scala and Jsoup

If you ever need to convert HTML to plain text using Scala or Java, I hope these Jsoup examples are helpful:

This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.

sed on macOS: How to append multiple lines of text to an HTML or XML file

As a brief note about the Linux/Unix sed command, today I learned how to append multiple lines of text to an HTML (or XML) file on macOS. The short answer is that I created a sed commands file named changes.sed with these contents:

This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.

A Scala shell script to read HTML H1 tag attributes

I’m putting this Scala shell script out here as a “source code snippet” so I can find it again if I need it. This file reads an input file that contains a series of HTML <h1> tags. I use this as part of a process of publishing an Amazon Kindle ebook from an HTML file, and in one of the steps of the creation process, I use this script to help create the Table of Contents (TOC) for the book.

Here’s the source code:

This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.