Skip to content

Instantly share code, notes, and snippets.

@TearTheSky
Last active August 29, 2015 14:00
Show Gist options
  • Save TearTheSky/11135100 to your computer and use it in GitHub Desktop.
Save TearTheSky/11135100 to your computer and use it in GitHub Desktop.
テキストエディタでいう、「フォルダ内を検索」のようなもの
$searchKey = "keyword which you want to search"
$outFileName = "result.txt"
$Items = get-childitem
foreach($aItem in $Items) {
$aLog = get-content $aItem
$results = @($aLog | select-string $searchKey)
$results | out-file $outFileName -append
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment