Can you use awk
?
As pointed out by wilhelmtell and Colin, replacing every space by a comma is not the right way because it also replaces the spaces in a string like NT AUTHORITY\NETWORK SERVICE
Use this instead
$ cat temp | awk 'BEGIN{FS = ","}{print $1","$8","$10}' | sed 's/"//g'
wmiprvse.exe,NT AUTHORITY\NETWORK SERVICE,N/A
[Old answer]
$ cat temp | awk 'BEGIN{FS = ","}{print $1, $8, $10}' | sed 's/"//g'|
sed 's/ /,/g'
wmiprvse.exe,NT,AUTHORITY\NETWORK,SERVICE,N/A
1.
awk 'BEGIN{FS = ","}{print $1, $8, $10}'
print column number 1, 8 and 10
2.
sed 's/"//g'
remove "
3.
sed 's/ /,/g'
replace space by a ,