![sed を使用した rsync 出力のフィルタリング --itemize-changes -i [重複]](https://linux33.com/image/229997/sed%20%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%9F%20rsync%20%E5%87%BA%E5%8A%9B%E3%81%AE%E3%83%95%E3%82%A3%E3%83%AB%E3%82%BF%E3%83%AA%E3%83%B3%E3%82%B0%20--itemize-changes%20-i%20%5B%E9%87%8D%E8%A4%87%5D.png)
rsync --itemize-changes -i --recursive --checksum --dry-run
両方のドライブの内容を比較した後、次の結果が得られた。
2024/03/12 08:31:01 [15248] .d Backups/Phone/Pictures/Screenshots/
2024/03/12 08:31:01 [15248] .f Backups/Phone/Pictures/Screenshots/Screenshot_20190726-175033.png
2024/03/12 08:15:12 [15248] cd+++++++++ Backups/User profile/user/.mozilla/firefox/fk3vbf2j.Old profile/storage/default/https+++www.example.org/ls/
2024/03/12 08:15:12 [15248] cf+++++++++ Backups/User profile/user/.mozilla/firefox/fk3vbf2j.Old profile/storage/default/https+++www.example.org/ls/index.html
ファイルエディタと比較してファイルが大きすぎるため、sedを使用して変更されていないファイルやフォルダ(およびファイルを含む.d
)をフィルタリングしたいと思います。.f
答え1
sed '/[0-9\/]* [0-9:]* [[0-9]*] \.[fd]*[[:space:]]*.*/d' source_file > result_file
結果:
2024/03/12 08:15:12 [15248] cd+++++++++ Backups/User profile/user/.mozilla/firefox/fk3vbf2j.Old profile/storage/default/https+++www.example.org/ls/
2024/03/12 08:15:12 [15248] cf+++++++++ Backups/User profile/user/.mozilla/firefox/fk3vbf2j.Old profile/storage/default/https+++www.example.org/ls/index.html
このため、私は正規表現を正常に作成しました。