Find text, patterns, and line numbers across website and documentation files.
Sheet: 04 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026
Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.
Quick commands
1. Find a literal string in one file
Select-String -LiteralPath 'C:\MGU\index.html' -Pattern 'component/lib.css' -SimpleMatch
2. Search all HTML files
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File -Filter '*.html' |
Select-String -Pattern 'footer-placeholder' -SimpleMatch
3. Return file, line number, and text
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File -Filter '*.html' |
Select-String -Pattern 'canonical' -SimpleMatch |
Select-Object Path, LineNumber, Line
4. Find files containing a regex pattern
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File -Filter '*.html' |
Select-String -Pattern '<h[1-6]\b' -List |
Select-Object -ExpandProperty Path
5. Find matches with surrounding lines
Select-String -LiteralPath 'C:\MGU\index.html' -Pattern 'main-content' -Context 2,2
6. Find files missing a literal marker
Get-ChildItem -LiteralPath 'C:\MGU' -Recurse -File -Filter '*.html' |
Where-Object { -not (Select-String -LiteralPath $_.FullName -Pattern 'footer-placeholder' -SimpleMatch -Quiet -ErrorAction Stop) }
Operational notes
Select-String uses regex unless -SimpleMatch is specified. A match is text evidence, not proof of valid HTML or an active link. For Unicode searches, verify source encoding first.