Hi I have a server with an old version of LXD on it which dosen't have the automated delete snapshots on it, so i created the following bash line to bulk delete but would like to add "pv" to it for a progress bar how can I put the following in a loop so pv can show me how many it has deleted of how many that match the pattern?
lxc info wiki | awk '{print$1}' | grep wiki | grep --null '2022' | xargs -n 1 -I{} lxc delete wiki/{}
I add PV at various points passing it to pv but only shows how long it takes to bring up the grep wiki. and doesn't proceed to make a progress bar for all of them listed in the to delete pile.
Edit
from the comments below here is what I am looking at, the following is an output from having got rid of most of the snapshots I needed to. Ideally I would want to get rid of snapshots by date, but it doesn't recognise the dates as a date
Name: wiki
Remote: unix://
Architecture: x86_64
Created: 2018
Status: Running
Type: persistent
Profiles: macvlan-default
Pid: 3170
Ips:
eth0: inet X
eth0: inet6 X
eth0: inet6 X
lo: inet 127.0.0.1
lo: inet6 ::1
Resources:
Processes: 60
CPU usage:
CPU usage (in seconds): 3891
Memory usage:
Memory (current): 231.60MB
Memory (peak): 893.12MB
Network usage:
eth0:
Bytes received: 145.47MB
Bytes sent: 116.42MB
Packets received: 287345
Packets sent: 61107
lo:
Bytes received: 127.05kB
Bytes sent: 127.05kB
Packets received: 1259
Packets sent: 1259
Snapshots:
wiki+28092019 (taken at 2019/09/28 14:22 UTC) (stateless)
wiki118012023 (taken at 2023/01/18 05:37 UTC) (stateless)
wiki119082023 (taken at 2023/08/19 02:39 UTC) (stateless)
wiki123092023 (taken at 2023/09/23 10:21 UTC) (stateless)
I don't know what the
pvaspect of your initial question was about but from your recent edit it sounds like all you really want to do is print the first field for everywiki...line between 2 dates, e.g.:Replace
cat filewithlxc info wiki.