I have used the below play to display the files and folders with some pattern

- name: Display backup files
  shell: "du -h {{partition}} --time | sort -rh | grep -o -P 
'(.*bk|.*bkup|.*bak|.*backup|.*logs' | sort -rh | awk -F'\t' '{print 
$3}'|uniq|head -n 100" 
  register: status


and while using this command i am getting output as below which i have stored 
in register variable called status

7.4G 2018-12-24 03:46 /logs/backups
6.4G 2018-12-24 03:46 /logs/backups/config_bkp_11dec
7.4G 2018-12-24 03:46 /logs/backups/config_bkp_18nov

The thing is i need to eliminate the entire child path lines amd need to hold 
the parent path /logs/backups... is there anyway to do that... 


-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/68e389ef-1d44-48d4-8164-9ee8371bfafa%40googlegroups.com.

Reply via email to