On 29.05.2019 16:45, Asha Omanakuttan wrote:
> I need some contents to be written in csv format to a file.
> 
> shell: ps -ef | grep java | awk '{print $1}'
> register: username
> 
> shell: ps -ef | grep java | awk '{print $2}'
> register: id
> 
> The output for username will be similar to :
> root
> admin
> test_admin
> 
> The output for id will be similar to:
> 1232
> 4343
> 2233
> 
> so I want this to be written to a csv file as
> 
> root,1232
> admin,4343
> test_admin,2233

Since you already using shell, do everything in one task

- shell: ps -ef | awk '/java/ { print $1","$2 }' > /path/my.csv


-- 
Kai Stian Olstad

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5a883184-8366-d9d4-7572-5046797aa781%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to