> Do split accepts only one square bracket[] parameter?
 
the python aquivalent (something similar to this should be happening in the 
backgound) would be:
 
   >>> myline = 'This line is a test, two, three, four, five, 6, seven'
   >>> print(myline.split(',')[4], myline.split(',')[5], myline.split(',')[6])
   five 6 seven
 
as you do not have an index 11 your concrete example makes no big sense in that 
regards.
 
I neither found the correct ansible syntax to translate that mentioned python 
logic into a TASK example like yours though.
maybe someone else here can help out with that
 
 

> On 08/29/2023 9:40 AM CEST Veera <[email protected]> wrote:
>  
>  
> Hi,
>  
> I have this playbook to print the columns  5 and 6 using the debug.
>  
> ---
> - name: playbook to print columns
>   hosts: localhost
>   gather_facts: no
>   vars:
>     myline: This line is a test, two, three, four, five, 6, seven
>   tasks:
>     - name: play to  print
>       debug:
>         msg:
>           - "{{ myline.split(',')[5] }}"
>           - "{{ myline.split(',')[6] }}"
>  
> It prints the details , But is there a way to print the columns  4,7 and 11 
> with a single split option. (instead of listing under msg: )
>  
>  - name: play to  print
>       debug:
>         msg:  "{{ myline.split(',')[4][7][11] }}"
>  
> Do split accepts only one square bracket[] parameter? 
>  
>           
>  
>  
> 
>  
> 
> --
> 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] 
> mailto:[email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/61d732eb-26b2-460f-98de-1db41a6deccan%40googlegroups.com
>  
> https://groups.google.com/d/msgid/ansible-project/61d732eb-26b2-460f-98de-1db41a6deccan%40googlegroups.com?utm_medium=email&utm_source=footer.
> 

-- 
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/1357095435.216963.1693300916372%40office.mailbox.org.

Reply via email to