1

I'm trying to make a log file for monitoring backup progress using borg deduplicating archiver. While I am logging, the file contains ^M control characters for each line despite running the script on linux. Is there a means to prevent borg from outputting in this format in the log file?

I tried piping the output (using |&) to tr -d '^M' before &>> to the log file, but in that case, while borg now displays a running status on the terminal, either nothing actually get's written to the log file in that case.

Alternatively, I've tried `tr -d '\r' in the hopes that it would keep new lines. In that case, the log file becomes just one big single line.

1
  • 1
    You can try sed -i 's/\r/\n/g' FILENAME, if you have the GNU version of sed, which you probably do on Linux. It won't fix the live output, but it'll fix newlines in the old output. If you don't have GNU sed, you can use perl: perl -i -pe 's/\r/\n/g' FILENAME.
    – dogoncouch
    Mar 31, 2018 at 18:44

0

You must log in to answer this question.

Browse other questions tagged .