Hi Not sure what "eliminate the entire child path lines" means - is that some local jargon? Giving actual preferred output would avoid us doing any guestimations and/or (mis)interpretations of said jargon.
Either way, yes you're using ansible, but just it's 'shell' module as a conveyor mechanism to execute a lot of piped shell commands. I would suggest adding a few extra. If any, this would avoid you dividing the text processing between the shell and ansible. Dick On Mon, 4 May 2020 at 13:40, Sivaraman P <[email protected]> wrote: > > 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. -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- 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/CAL8fbwMkkeDPC%2B6EJrCkFuuVdUcoBn0ZQgB4tepMACGa0Ed8aA%40mail.gmail.com.
