嘿,我希望对一些数据进行重复数据删除并合并 CSV 中的列。我不知道该怎么做。这是我正在使用的数据示例:
cmmc,stig,descr
AC.1.001,SV-205663r569188_rule,The ability to set access permissions and auditing is critical to maintaining the security and proper access controls of a system. To support this volumes must be formatted using a file system that supports NTFS attributes.
AC.1.001,SV-205667r569188_rule,Inappropriate granting of user rights can provide system administrative and other high-level capabilities.
AC.1.002,SV-205663r569188_rule,The ability to set access permissions and auditing is critical to maintaining the security and proper access controls of a system. To support this volumes must be formatted using a file system that supports NTFS attributes.
AC.1.002,SV-205665r569188_rule,Enterprise Domain Controllers groups on domain controllers.
我非常接近我正在寻找的数据,但努力|<value of 'descr'>
在第二列中的项目之后添加:
这是我的脚本:
Import-CSV '.\input.csv' | Group-Object 'cmmc' |
ForEach-Object {
[PsCustomObject]@{
cmmc = $_.name
stig = $_.group.stig -Join '
'
}
} | Export-Csv '.\output.csv' -NoTypeInformation
输出看起来像这样(为便于阅读而格式化,省略了列名):
AC1.001 SV-205663r569188_rule
SV-205665r569188_rule
AC1.002 SV-205663r569188_rule
SV-205665r569188_rule
但我正在寻找这个:
AC.1.001 SV-205663r569188_rule|The ability to set access permissions and auditing is critical to maintaining the security and proper access controls of a system. To support this volumes must be formatted using a file system that supports NTFS attributes.
SV-205667r569188_rule|Inappropriate granting of user rights can provide system administrative and other high-level capabilities.
AC.1.002 SV-205663r569188_rule|The ability to set access permissions and auditing is critical to maintaining the security and proper access controls of a system. To support this volumes must be formatted using a file system that supports NTFS attributes.
SV-205665r569188_rule|Enterprise Domain Controllers groups on domain controllers.