Hi developer,
i am trying to read in text file. The file name is test.txt:
aa aa aa 4
bb bb bb 3
cc cc cc 5
dd dd dd 1
ee ee ee 2
Here is my sample windows powershell script:
$reg = ".........."
Get-Content .\Test.txt|Select-String -Pattern $reg -AllMatches | ForEach-Object { $_.Matches } |
ForEach-Object { $_.Groups[0].value}output:
aa
aa
aa
4
bb
bb
bb
3
cc
cc
cc
5
dd
dd
dd
1
ee
ee
ee
2
I want to display output like this:
aa,aa,aa,4
bb,bb,bb,3
cc,cc,cc,5
dd,dd,dd,1
ee,ee,ee,2
How to saperated comma and no new line after regular expression?
Thanks