如何使用Powershell将行转换为列? [英] How to convert rows into columns using Powershell?

查看:136
本文介绍了如何使用Powershell将行转换为列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Windows Power shell脚本将行转换为列? 
$


基本上,如果第一列具有相同的值,我需要将行连接到列中。 
$


以下是样本输入文件。

A 1,2,3

A 4 ,5,6¥
B 1,2,3

B 4,5,6

C 1,2,3

C 2,3,4

C 3,4,5



这是所需的输出: 

A 1,2,3,4,5,6

B 1,2,3,4,5,6

C 1,2 ,3,2,3,4,3,4,5
$


为任何帮助干杯: - )

How to convert rows into columns using Windows Power shell script? 

Basically I need to join the rows into columns if the first column has the same value. 

Below is the sample input file.
A 1,2,3
A 4,5,6
B 1,2,3
B 4,5,6
C 1,2,3
C 2,3,4
C 3,4,5

Here is the desired output: 
A 1,2,3,4,5,6
B 1,2,3,4,5,6
C 1,2,3,2,3,4,3,4,5

Cheers for any help :-)

推荐答案

为此,我们将使用"Group-Object"

For that we would use "Group-Object"


这篇关于如何使用Powershell将行转换为列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆