fread is not yet able to read fixed-width files .
I also often come across files annoyingly stored like that. Feel free to add a feature request on the Github page.
In your case, this may not be the case, but your sed solution will not work on the set of FWFs that I come across, because there is no space between the columns, for example. you will see lines like 00010 which actually contain 3 fields.
In this case, you will need a field width dictionary, after which you have several options:
read.fwf in R- Write a program
fwf csv (I use the one I wrote in Python , and it pretty quickly, could share the code if you want) - basically an extended version of your original approach, so you no longer have to deal with FWF - Open it in Excel / LibreOffice / etc; There is a built-in FWF reader that tries (usually badly) to guess the column widths, which at least does half the work of specifying the column widths for you. Then you can save it as .csv or something there.
I personally adhere to the second option most often. read.fwf not optimized like fread , so it will probably be slow. And if you have a lot (say, 20+) of FWF to read, the third option is quite tedious.
But I agree that it would be nice to have something like this built in to fread .
source share