# how split csvfile for each row for  single column

**URL:** <https://forum.ansible.com/t/how-split-csvfile-for-each-row-for-single-column/28258>\
**Category:** Ansible Project\
**Created:** [August 4, 2018, 12:48am UTC](https://forum.ansible.com/t/how-split-csvfile-for-each-row-for-single-column/28258 "2018-08-04T00:48:31Z")\
**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:** [August 4, 2018, 12:48am UTC](https://forum.ansible.com/t/how-split-csvfile-for-each-row-for-single-column/28258/1 "2018-08-04T00:48:31Z")

</div>

```auto
I dont find way to use row with column , in csvfile module it is splitting only for single row it is not included rest of the lines in csvfile to split 

```

```auto

```

```auto
please share how to can do achieve this?

```

```auto

```

```auto
following playbook i am using 

```

```auto
###################################

```

```auto

```

```auto
---
- hosts: localhost
  connection: local
  gather_facts: yes

  tasks:

  - name: set_fact for produser
    set_fact:
      produser: "{{ lookup('csvfile', 'Production file=gpc.csv col=2 
      delimiter=,')}}"

  - name: checking produser
    debug:
        msg: "{{produser}}"

  - name: set_fact for prodcomm
    set_fact:
          prodcomm: "{{ lookup('csvfile', 'Production file=gpc.csv col=3 
          delimiter=,') }}"

  - name: checking prodcomm
    debug:
         msg: "{{prodcomm}}"

```

```auto

```

```auto
csvfile which am using to split column 3 and 4 for each row

```

```auto
###########################################################

```

```auto
following csvfile contain username (abst_o) at column 3 and column 4 contain command (cp /appl/abst/abst_o1/etc/bst/.passfile /tmp)

```

```auto

```

```auto
Acceptance,Backup .passfile file,5,abst_o,"cp /appl/abst/abst_o1/etc/bst/.passfile /tmp"

```

---

<div class="post-metadata">

**Author:** ![Ali\_Khawaja](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Ali\_Khawaja](https://forum.ansible.com/u/Ali_Khawaja)\
**Post date:** [August 4, 2018, 4:54pm UTC](https://forum.ansible.com/t/how-split-csvfile-for-each-row-for-single-column/28258/2 "2018-08-04T16:54:29Z")

</div>

Atul, you want to split by columns?

---

<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:** [August 4, 2018, 5:44pm UTC](https://forum.ansible.com/t/how-split-csvfile-for-each-row-for-single-column/28258/3 "2018-08-04T17:44:12Z")

</div>

Yeah want to split colum 3 and 4 for each row , without any extra characters like “/ , /“, /r,/n

Please tell me ho can I do this.
