Text parsing analyzes textual output to find, extract, or transform useful information. Administrators may parse command output or log files, but formatting changes can break commands that depend on column positions. section 8.2 section 21.0
Common approaches include:
- Use grep, awk, sed, or regular expressions to identify patterns in text. section 8.2
- Use PowerShell objects when possible, addressing named properties instead of parsing displayed column positions. section 8.2
- Use regular expressions in PowerShell when textual content, such as a log file, still needs parsing. section 21.0
Extracting process identifiers
A process listing displays several columns, including process names and IDs. Text-based processing can select matching rows and extract identifiers for a later administrative action; PowerShell objects reduce dependence on the displayed layout. section 8.2
PS /Users/travis> Get-Process
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
39 5 1876 4340 52 11.33 1920 Code
31 4 792 2260 22 0.00 2460 Code
29 4 828 2284 41 0.25 3192 Code
574 12 1864 3896 43 1.30 316 pwsh
181 13 5892 6348 59 9.14 356 ShipIt
306 29 13936 18312 139 4.36 1300 storeaccountd
125 15 2528 6048 37 0.17 1756 WifiAgent
5159 7329 85052 86436 118 1.80 1356 WifiProxy
Inspect the process listing to see the tabular text that may be searched, filtered, or converted into selected identifiers. section 8.2












