Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Delete specific word from output

$
0
0

Hello guys

Maybe you can help me with a problem. What I'm trying to do is that I can filter or delet a specific word from the output that is writte into $file. My results in the textfile "nslookup2" look like this:

Line                                  
----                                  
Name:    server.domain.blabla.com
Name:    server2.domain.blabla.com 
Name:    server3.domain.blabla.com

Now I don't want to have the word "Name:   " in the output file. Can I somehow filter this word?

$path="C:\Users\xxxxx\Desktop\Backupclients3.txt"
$i= Get-Content $path
$ausgabe="C:\Users\xxxxx\Desktop\nslookup2.txt"


foreach ($names in $i) 
	{
		$i=$names
		nslookup $i 2>&1| select-string "Name|non-existent" -outvariable +file 

	}
$file | format-table -autosize -property line >>$ausgabe


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>