Skip to content

Instantly share code, notes, and snippets.

@tostercx
Created December 14, 2016 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tostercx/dd7e9177055956afd25216ce0405396e to your computer and use it in GitHub Desktop.
Save tostercx/dd7e9177055956afd25216ce0405396e to your computer and use it in GitHub Desktop.
$test = @{};
$out = New-Object System.Text.StringBuilder;
$lines = Get-Content 'f1.txt'
foreach ($line in $lines) { $test[$line] = 1; }
$lines = Get-Content 'f2.txt'
foreach ($line in $lines) { if($test[$line]) { $null = $out.Append("$line`r`n") } }
Set-Content out.txt $out.ToString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment