Hi developer,
Here is my logic script:
$fileList = dir 'H:\aa.txt'
$regex = "(([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?))|((?<=\"")((\w+(\s+\w+)?|\d+))(?<!\""))|[a-zA-Z]+|(?<=\"")(?=\"")"
foreach ($file in $fileList){
$matchInfo = @((Get-Content $file) | ForEach-Object{ $_.Trim()}| Select-String -Pattern $regex -AllMatches)
$output = foreach($minfo in $matchInfo){
foreach($match in @($minfo.Matches | Foreach {$_.Groups[0].value})){
$match
}
}
$output
}
where aa.txt:
aa aa aa
bb bb bb
I run it and display output like this:
aa aa aa bb bb bb
But i need to display output like this:
aa,aa,aa
bb,bb,bb
Any Idea?
Thanks