# Reading the Notepad file content and modifying them using powershell.

**URL:** https://forums.powershell.org/t/reading-the-notepad-file-content-and-modifying-them-using-powershell/6113
**Category:** PowerShell Help
**Created:** [April 2, 2016, 11:25pm UTC](https://forums.powershell.org/t/reading-the-notepad-file-content-and-modifying-them-using-powershell/6113 "2016-04-02T23:25:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mrnarayangupta](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/mrnarayangupta/32/203_2.png) [@mrnarayangupta](https://forums.powershell.org/u/mrnarayangupta)
#### Post date: [April 2, 2016, 11:25pm UTC](https://forums.powershell.org/t/reading-the-notepad-file-content-and-modifying-them-using-powershell/6113/1 "2016-04-02T23:25:15Z")

</div>

Hi Mates,

I need help with below:

1. One CSV file which has server name and its IP address.
2. two conf files is placed on each server under c:\temp named as abc.conf and xyx.conf. 2nd line of the files contains IP address (xx.xxx.xx.xxx).
3. I want powershell to read the csv, pick the IP address against the server name from csv.  
4.and Replace ip address in conf files on 2nd line only for each server with the picked IP in step3.
4. I want to verify the changes using powershell also.

Cheers,  
Narayan

---

<div class="post-metadata">

### Author: ![mrnarayangupta](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/mrnarayangupta/32/203_2.png) [@mrnarayangupta](https://forums.powershell.org/u/mrnarayangupta)
#### Post date: [April 3, 2016, 12:12am UTC](https://forums.powershell.org/t/reading-the-notepad-file-content-and-modifying-them-using-powershell/6113/2 "2016-04-03T00:12:32Z")

</div>

(get-content c:\1.txt) | foreach-object {$\_ -replace “abc”, “xyz”} | set-content c:\1.txt

---

<div class="post-metadata">

### Author: ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)
#### Post date: [May 16, 2024, 8:42pm UTC](https://forums.powershell.org/t/reading-the-notepad-file-content-and-modifying-them-using-powershell/6113/3 "2024-05-16T20:42:35Z")

</div>


