Piping rclone output to a file, but only the good stuff?

I’m piping rclone output to a file (which I am then emailing) but the file contains all the status messages i.e. progress reports. I want to see those reports in the terminal, but not in the piped output. Any ideas, please? Thanks. (Am on Linux.)

EDIT: SOLVED.

Is it easier to output to a logfile and mail that? What do you mean when you say good stuff?

Example here:

https://askubuntu.com/questions/625224/how-to-redirect-stderr-to-a-file/625230

Thanks for the reply. I haven’t been clear (and I’ve corrected a typo in my original post).

I am outputting to a log file and then mailing the file.

The ‘good stuff’ that I want in the log file - and that I want to be the only text in the log file - consists of error messages and success messages. Are you suggesting that those messages come via stderr, whereas the progress reports come via stdout - such that I should pipe only the former to my log file?

EDIT: to clarify further, this is the sort of thing I wish to exclude from the log file:

0 / 0 Bytes, -, 0 Bytes/s, ETA -1.639k / 1.592 kBytes, 103%, 347 Bytes/s, ETA -1.639k / 1.592
+kBytes, 103%, 315 Bytes/s, ETA -1.639k / 1.592 kBytes, 103%, 288 Bytes/s, ETA -1.639k /
+1.639 kBytes, 100%, 265 Bytes/s, ETA 0s1.639k / 1.639 kBytes, 100%, 245 Bytes/s, ETA
+0s1.639k / 1.639 kBytes, 100%, 229 Bytes/s, ETA 0s1.639k / 1.639 kBytes, 100%, 214 Bytes/s,
+ETA 0s

What’s the full command you are running? I think you can turn off the stats so you don’t see that. I can check if you share the command and do some testing.

The full command I am running varies - commands are run from a script. Turning off the stats is not an option - for, to repeat: I wish to see the stats when I am running rclone in an interactive terminal, but (when running rclone in an interactive terminal or in the background) I do not wish the stats to go into the log file.

No need for italics and such as I wanted to see what you are running to offer ideas, but if you aren’t going to share, I’m not sure I can help.

I’d suggest you use -P --log-file log.txt - the -P will show the stats on the screen interactively and it will write just the log to the log file.

ncw: thank you - that did it.

1 Like

So turning off stats was an option? :blush:

I think not!

the -P will show the stats on the screen interactively

and dumps the final bit of stats into the log file :slight_smile: