backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / tests / qemucapsfixreplies
blob597f9ecd6e46ace658893130e7582cc851a5dcea
1 #!/bin/sh
3 if [ "$#" -ne 1 ] || [ "$1" = "--help" ] || [ ! -f "$1" ]; then
4 echo "This script fixes replies ids in QEMU replies files."
5 echo ""
6 echo " Usage: $0 path/to/qemu.replies"
7 exit 0
8 fi
10 awk -i inplace \
11 'BEGIN {last=0; pattern="libvirt-[0-9]+"}
13 if (match($0, "libvirt-1[^0-9]")) {
14 count=1;
16 if (match($0, pattern)) {
17 str="libvirt-" count;
18 sub(pattern, str, $0);
19 if (last != count) {
20 last=count;
21 } else {
22 count++;
25 print
26 }' "$1"