Enjoying Open Source Software

Script to convert OPML file to GNU recutils database


The Newsboat RSS reader is an awesome RSS reader.

It runs in your terminal, so can be used inside a Tmux session.

Newsboat uses a plain text file for the user to configure his or her list with RSS feeds.

GNU Recutils

The GNU Recutils is a set of tools and libraries to access human-editable, plain text databases called recfiles.

These recfiles can be generated by scripts and are not only human-editable but also machine-readable.


OPML (Outline Processor Markup Language) is an XML format for outlines which is used to import and export RSS feed lists between different RSS readers.

Newsboat can export its list of feeds in the OPML format, with newsboat -e.

Simple script to create GNU recutils recfile


echo "%rec: newsfeeds" > feeds.rec
echo "%mandatory: feed url title" >> feeds.rec
echo "%sort: title" >> feeds.rec
echo "%unique: url" >> feeds.rec

newsboat -e | grep  outline  | sed 's/    <outline type="rss" /\
/' |  sed "s/xmlUrl=/feed: /" | sed 's/htmlUrl=/\
url: /' | sed 's/title=/\
title: /' | sed 's/\/>//' | sed 's/\"//g' >> feeds.rec

echo "Feeds written to feeds.rec"

This script reads the output from newsboat -e and parses that with sed to create the recfile.

Here is an example of the output:

%rec: newsfeeds
%mandatory: feed url title
%sort: title
%unique: url

title: Susam's Blog

title: notes

title: Daring Fireball


Next steps

For me this was a first step. I can now add categories to the records.

This way I can manage my feeds better, and have a sound set of categories :)


Kudos to Sergey Matveev for publishing his feeds and links as a recfile. See his links page


⇽ Perl script to fetch bookmarks from Linkding REST API Convert Markdown-ish to PDF with Groff MOM ⇾