Sorry, it seems to be a simple question, but I’m not able to figure out how to do it in Julia. We receive text files, but they have ‘\01’ or ‘\00’ as newline. We’d like read (stream) the file content, map ‘\01’ to ‘\r’ and then continue reading the lines. Something like (pseudo code):
open("myfile.dat", read=true) do fd
# fd = map(fd, '\01' => '\r') # <= How to do this?
fd = replace(fd, '\01' => '\r') # More appropriate, as pointed our by nilshg
for line in eachline(fd)
...
end
end
Preferably it should work with input from files, cmds and IOBuffer
I know we could invoke an external command to do the translation, but we are using Windows as well as Linux, and we’d like an approach that easily works on both.
Thanks a lot for your help