As mentioned in earlier posts, I don’t close out one year until I am well into the next year. This is because a) I don’t need to close out my accounting at the end of a calendar year and b) it makes data entry easier. What I mean by the latter point is that I enter transactions by hand, so if I enter a transaction that matches an existing payee, I get the default information from the last transaction. As a result, I don’t have to type anything for parts of the transaction that aren’t different from the previous one. For example, in many cases the categories don’t change. Or there may be a recurring bill that has the same charge every month. When items don’t change, I can just press Enter to accept the default value. In short, I don’t want to be in a hurry to close out 2023. (I understand that there is a way to close out 2023, work on a new 2024 file, but get the defaults from the old file by referring to both files when using the “add” command. However, I find it simpler to use my system of waiting a couple of months to close out 2023.)
Just the same, now that we are in 2024, I am starting to think about things to do in preparation for closing out 2023. One of these involves a change that some months ago I decided to do. Specifically, I had used uppercase letters for category names. For example
Expenses:Groceries
I decided that I would like to have them lowercase. Why? Well, lowercase is slightly easier to type. Also, I see on the hledger.org site that the examples there seem to be in lowercase, so it’s perhaps more canonical.
And several months ago I created ways in sed, awk, and R to lowercase account names. I made an exception for words in account names that were proper nouns. Proper nouns were left capitalized. I didn’t need 3 ways, but it was a valuable learning exercise for me. In any case, I had 3 tools that could each independently do the job. I tested them on my data. They worked. And then I didn’t do the final step of swapping in the new data file, i.e., the one with the new lowercase letters. In short, I procrastinated.
However, I was now motivated to make the change. I dug through my old programming files to try to remember what I had come up with. The one that caught my eye was the version for sed. It was just so elegantly simple, as the sed file lines look like:
s/Expenses:Groceries/expenses:groceries/g
Thus, sed it was to do the job. I backed up my original file. Output the new version into a file, and done!