# How to string the word in file content and convert into CSV from multiple file

**URL:** <https://forums.powershell.org/t/how-to-string-the-word-in-file-content-and-convert-into-csv-from-multiple-file/9104>\
**Category:** PowerShell Help\
**Created:** [August 1, 2017, 7:36am UTC](https://forums.powershell.org/t/how-to-string-the-word-in-file-content-and-convert-into-csv-from-multiple-file/9104 "2017-08-01T07:36:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert17](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@robert17](https://forums.powershell.org/u/robert17)\
**Post date:** [August 1, 2017, 7:36am UTC](https://forums.powershell.org/t/how-to-string-the-word-in-file-content-and-convert-into-csv-from-multiple-file/9104/1 "2017-08-01T07:36:02Z")

</div>

Hello!

I have application file and content looks like below. Each file having 5

or 6 server name in the content, same I have 800+ file under data folder.

**A sample of file content:-**

HOST “[Developserver.com](http://Developserver.com)” [Developserver.com](http://Developserver.com)  
{  
-trees  
“/”  
-exclude  
“/tmp/pro\*\*”  
“/var/opt/Client”  
“/dev/\_\_pv\*\*”  
“/var/locks/slp.lock”

}

HOST “[Testserver.com](http://Testserver.com)” [Testserver.com](http://Testserver.com)  
{  
-trees  
“/”  
-exclude  
“/tmp/proc\*\*”  
“/var/opt/Client”  
“/dev/\_\_pv\*\*”  
“/var/locks/slp.lock”

}

Now, how to read and string the content after “-exclude” and convert into

csv format like this

**A Sample of Result:-**

FileName HostName Excludelist  
Dummy [Developserver.com](http://Developserver.com) “/tmp/pro\*\*”

```
                                                 "/var/opt/Client"
	                                                          

                                                  "/dev/__pv**"
	                                                          

                                                  "/var/locks/slp.lock"

```

Dummy [Testserver.com](http://Testserver.com) “/tmp/pro\*\*”

```
                                                 "/var/opt/Client"
	                                                          

                                                  "/dev/__pv**"
	                                                          

                                                  "/var/locks/slp.lock"

```

Any help much appreciated. Thx RR

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [August 2, 2017, 12:44am UTC](https://forums.powershell.org/t/how-to-string-the-word-in-file-content-and-convert-into-csv-from-multiple-file/9104/2 "2017-08-02T00:44:11Z")

</div>

The following video might help you with your task [Sophisitcated Techniques of Plain Text Parsing](https://youtu.be/Hkzd8spCfCU?list=PLfeA8kIs7Coehjg9cB6foPjBojLHYQGb_)

---

<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:37pm UTC](https://forums.powershell.org/t/how-to-string-the-word-in-file-content-and-convert-into-csv-from-multiple-file/9104/3 "2024-05-16T20:37:50Z")

</div>

Closed on May 16, 2024, 8:37pm UTC


