Sometimes you need to change some data in your hledger file. For example, you made purchases from Acme, but you realize that in your hledger file the name was written every time as Accme. So, you decide to correct the seven transactions that mention the business name incorrectly.
In the above case, three possible solutions are to
- edit the file directly, manually locating each item and correcting it
- use search and replace
- use a tool such as sed
Note that whichever solution you use, make sure to have a good backup of your data before you start making changes! It’s too easy to make an unintended change, and sometimes those changes are difficult, if not impossible, to recover from.
As I am currently learning sed, it is tempting to use sed for such changes. However, search and replace can be the right choice as it allows you to see each item – in context – that search finds, to confirm that the match is what needs changing, and then move to the next item. So, for the above example of correcting Accme seven times, I probably would use search and replace.
On the other hand, if you have a ton of changes to make, something like sed can be your friend. For example, I currently use capital letters for my account categories. For example, one of them is
However, I would like to use lowercase consistently for account names. That is, all my accounts should look like:
It’s going to be much more efficient to use sed due to the many changes that are needed. As noted above, though, make sure you have a good backup, and make the changes on a copy of your data. Sed is a powerful tool, and like any powerful tool you can find yourself making mistakes in the blink of an eye.
Finally, if you are not familiar with search and replace or sed, it’s OK to make the corrections manually, one at a time. Or you may decide that you can live with the problem for now. However, I would recommend to at least learn search and replace. And for a third time, because it is so important, make sure you have a backup copy before making changes.
This website now shows a link to use for RSS feeds. Many thanks to the people on the hledger forum who have been providing valuable feedback for me!
As you can perhaps tell from the above, I have almost zero experience with RSS readers. However, I am pleasantly pleased with an app (AnOtterRSS) that I installed this week. It seems to work well, and I am planning to use it more widely.