I'm using rsync to backup some files:
rsync -PaSh --stats --delete -e "-i key -p XXXX" "/source/" username@192.168.0.1:/destination/ 2> output.txt | grep -e 'bytes received' -e 'total bytes' -e files -e 'total file size:' >> output.txt
because there are thousands of files, I only want to see any errors and a summary at the end.
The above command outputs this:
rsync: delete_file: unlink(test/test.txt) failed: Permission denied (13)
Number of files: 12 (reg: 10, dir: 2)
Number of created files: 0
Number of regular files transferred: 0
sent 382 bytes received 137 bytes 41.52 bytes/sec
I want to convert to uppercase any errors only (to draw attention to them) and leave the summary unchanged.
So it would look like this:
RSYNC: DELETE_FILE: UNLINK(TEST/TEST.TXT) FAILED: PERMISSION DENIED (13)
Number of files: 12 (reg: 10, dir: 2)
Number of created files: 0
Number of regular files transferred: 0
sent 382 bytes received 137 bytes 41.52 bytes/sec
How can I achieve this?
Thanks
tail
thersync
stdout to get the summary info? Or does it get displayed elsewhere besides the very end of thersync
run? (If it would work that's a lot better than scanning the whole thing withgrep
.) – B Layer Jan 06 '18 at 20:36