# Append hostname to all lines in a file on a windows remote server

**URL:** <https://forum.ansible.com/t/append-hostname-to-all-lines-in-a-file-on-a-windows-remote-server/30731>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [July 9, 2019, 11:43am UTC](https://forum.ansible.com/t/append-hostname-to-all-lines-in-a-file-on-a-windows-remote-server/30731 "2019-07-09T11:43:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asha\_Omanakuttan](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@Asha\_Omanakuttan](https://forum.ansible.com/u/Asha_Omanakuttan)\
**Post date:** [July 9, 2019, 11:43am UTC](https://forum.ansible.com/t/append-hostname-to-all-lines-in-a-file-on-a-windows-remote-server/30731/1 "2019-07-09T11:43:27Z")

</div>

Hi all,

I have a csv file as below

admin\_server, id:1, /tmp  
admin\_group, id:3, /home  
user\_group, id:5, /root

The number of lines in the file might vary.

I need to append hostname to every lines in the file. i.e. I need to add a column 1 which will have the hostname.

1st server:

server1,admin\_server, id:1, /tmp  
server1,admin\_group, id:3, /home  
server1,user\_group, id:5, /root

2nd server.

server2,admin\_server, id:1, /tmp  
server2,admin\_group, id:3, /home  
server2,user\_group, id:5, /root

In linux, replace module was used and it worked fine. But in windows the replace module is not working.Kindly advise.
