问题原文
原帖链接 · horsley · CC BY-SA 4.0
I use rsync to backup a directory which is very big, containing many sub-directories and files, so I don't want to see the "incremental file list". I just want to know the summary in the end. If I use the argument -q, nothing is output at all. Can I make rsync output only the summary?
已采纳解答
原帖链接 · Marco · CC BY-SA 3.0
Use the following:
rsync -vr src/ dest/ | sed '0,/^$/d'
Explanation: rsync is run in verbose mode using the -v flag. It outputs a detailed file list, an empty line and the summary. Now sed is used to take advantage of the fact that the summary is separated by an empty line. Everything up to the first empty line is not printed to stdout. ^$ matches an empty line and d prevents it from being output.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
