# with list how to split from comma(,) with index number value ansible

**URL:** <https://forum.ansible.com/t/with-list-how-to-split-from-comma-with-index-number-value-ansible/28133>\
**Category:** Ansible Project\
**Created:** [July 24, 2018, 10:15am UTC](https://forum.ansible.com/t/with-list-how-to-split-from-comma-with-index-number-value-ansible/28133 "2018-07-24T10:15:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atul\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Atul\_Sharma](https://forum.ansible.com/u/Atul_Sharma)\
**Post date:** [July 24, 2018, 10:15am UTC](https://forum.ansible.com/t/with-list-how-to-split-from-comma-with-index-number-value-ansible/28133/1 "2018-07-24T10:15:01Z")

</div>

Hello i have csv file and want to read line by line and split the string with comma(,) along with index number and want to store in register variable

from following gsv i want to fetch user\_name which is in index number 2 (pbst\_o1) and command(,/appl/pbst/pbst\_o1/bin/povera\_bst.ksh) index 3 from each line

following is gpc.csv

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [July 24, 2018, 10:23am UTC](https://forum.ansible.com/t/with-list-how-to-split-from-comma-with-index-number-value-ansible/28133/2 "2018-07-24T10:23:35Z")

</div>

Forgive me, but I think if what you are doing involves that input file, you are probably doing it wrong.

Regards, K.

---

<div class="post-metadata">

**Author:** ![Atul\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Atul\_Sharma](https://forum.ansible.com/u/Atul_Sharma)\
**Post date:** [July 24, 2018, 11:13am UTC](https://forum.ansible.com/t/with-list-how-to-split-from-comma-with-index-number-value-ansible/28133/3 "2018-07-24T11:13:49Z")

</div>

Can you please suggest correct way ?

It will great help

Thanks
