Powershell: Only export string values -
i have script reads text file, captures specific string values via select-string , writes csv file. issue having automatically adds additional columns not want:
ignorecase linenumber line filename path pattern context matches
the string values want under line - how have output string values have captured?
use select-object -expandproperty grab single property value matchinfo object select-string returns:
$matchedstrings = get-item c:\windows\system32\windowspowershell\v1.0\en-us\about_foreach.help.txt |select-string "operator" $matchedstrings | select-object -expandproperty line | out-file c:\mystrings.txt if want output single-column csv file , retain line header, use select-object -property instead:
$matchedstrings | select-object -property line | export-csv c:\strings.csv -notypeinformation
Comments
Post a Comment