Difference between revisions of "Reading a file"

From MyWiki
Jump to: navigation, search
(Created page with " $lines=Get-Content myfile.txt $lines | ForEach-Object{ Test-Connection $_.Split(' ')[1] }")
 
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
$lines=Get-Content myfile.txt
+
<source lang="powershell">
 +
$lines=Get-Content myfile.txt
 
     $lines |
 
     $lines |
 
     ForEach-Object{
 
     ForEach-Object{
 
         Test-Connection  $_.Split(' ')[1]
 
         Test-Connection  $_.Split(' ')[1]
 
     }
 
     }
 +
 +
 +
$lines=Get-Content myfile.txt
 +
    $lines |
 +
    ForEach-Object{
 +
        Write-Host  $_
 +
    }
 +
</source>
 +
http://technet.microsoft.com/en-us/library/ee692806.aspx    Reading particular lines from a file

Latest revision as of 15:00, 21 October 2014

 
$lines=Get-Content myfile.txt
    $lines |
     ForEach-Object{
         Test-Connection  $_.Split(' ')[1]
     }
 
 
$lines=Get-Content myfile.txt
    $lines |
     ForEach-Object{
         Write-Host  $_
     }

http://technet.microsoft.com/en-us/library/ee692806.aspx Reading particular lines from a file