Hello some one know how to get this.
I have multiple csv`s . I want to pull a string from those.
Becasue the number is multiple times in the file I only want the hace the first hit.
# First Script: Collect csc_reader.serial_number from Bit files
$Files = Get-ChildItem "C:\temp" -Filter *.csv
$outfile = "C:\Temp\output\output.csv"
foreach ($csv in $files){
$Csv -match '4100\w+'
$Matches
#Out-File $outfile
}
# Second script: - collect csc_reader.serial_number from Bit files
#
$Files = Get-ChildItem "C:\temp" -Filter *.csv
$outfile = "C:\temp\output\output.csv"
foreach ($csv in $files){
Write-Host "Export csc_reader.serial_number from $csv"
Import-Csv $csv.FullName | Select csc_reader.serial_number, network.hostname, rtc | select -First 1 | # where {$_.rtc -like "Wed, 21 Sep 2022*"} | select -First 1 `
Export-Csv $outfile
Out-File $outfile
}