... | awk 'NR>5' | while read -r timestamp filename; do rm -rf "${filename}"; done
If read indicates more fields than variables, the remaining ones are simply concatenated into the last specified variable. In our case, we extract the timestamp and use everything else as it is for the file name. We iterate over the output and run rm for each entry.
I would recommend doing a test run with echo instead of rm so you can check the results first.
Alternatively, if you prefer xargs -0 version:
... | awk 'NR>5' | while read -r timestamp filename; do printf "%s\0" "${filename}"; done | xargs -0 rm -rf
It also uses while read , but prints each file name with a zero byte delimiter, which can be accepted by xargs -0 .
source share