$buildLogPath = Join-Path $PSScriptRoot "arm_build.log"
$errorLogPath = Join-Path $PSScriptRoot "arm_warning.log"

if (Test-Path $buildLogPath) {
    $content = Get-Content $buildLogPath
    $matches = $content | Select-String -Pattern "\bwarning\b" -CaseSensitive:$true
    
    if ($matches) {
        $matches | ForEach-Object { $_.Line } | Set-Content $errorLogPath
        Write-Host "Warning lines have been extracted to $errorLogPath"
        Write-Host "Found $($matches.Count) matches"
    } else {
        Write-Host "No warnings found in the build log"
    }
} else {
    Write-Host "Error: Build log file not found at $buildLogPath"
}