I have the following line in my bash script:
restic backup --verbose --verbose --files-from $SRC_FILE --exclude-file $EXCLUDE_FILE | grep -v unchanged
The purpose is to have a live output of any changed file so that I can decide if the snapshot is worth keeping afterwards (as restic lacks a dry-run feature)
Now I would like to port this command to Windows. This is my initial attempt
restic -r test_restic backup test --verbose --verbose | findstr /V unchanged
However, when run in a cmd window on my Windows 10 machine (1809), something like the following is produced:
e[2Kopen repository
e[2Klock repository
e[2Kload index files
e[2Kusing parent snapshot 958accad
e[2Kstart scan on [test]
e[2Kstart backup on [test]
e[2Kscan finished in 0.246s: 4 files, 10.277 KiBrors
e[2K[0:00] 0 files 0 B, total 1 files 26 B, 0 errors
e[2KFiles: 0 new, 0 changed, 4 unmodified
e[2KDirs: 0 new, 0 changed, 0 unmodified
e[2KData Blobs: 0 newtal 1 files 26 B, 0 errors
e[2KTree Blobs: 0 newtal 1 files 26 B, 0 errors
e[2KAdded to the repo: 0 B l 1 files 26 B, 0 errors
e[2K[0:00] 0 files 0 B, total 1 files 26 B, 0 errors
e[2Kprocessed 4 files, 10.277 KiB in 0:00B, 0 errors
e[2Ksnapshot 0f361c77 savedal 1 files 26 B, 0 errors
e[2K[0:00] 4 files 10.277 KiB, total 4 files 10.277 KiB, 0 errors
e[1A
I know this should be due to the mis-handling of ANSI escape codes. But I would like to know if anyone of you have an idea on how to deal with this? Simply removing the ANSI escape codes does not work as the output is still a bit garbled.
Any help would be greatly appreciated. Thanks a lot