gpt4 book ai didi

linux - 将具有模式的行转置为列

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:46:36 24 4
gpt4 key购买 nike

每个人。

这种具有特定模式的从行到列的转换一直困扰着我。

我想将下面的行更改为列,例如,

来自

20:20:10
abc_flow.out
sss_flow.out
20:20:11
bcd_flow.out
qcd_flow.out

20:20:10 abc_flow.out sss_flow.out
20:20:11 bcd_flow.out qcd_flow.out

谢谢!

最佳答案

当且仅当您的 Input_file 与所示示例相同(相同)时,然后使用简单的 xargs

xargs -n3 <  Input_file

来自 man xargs:

-n max-args Use at most max-args arguments per command line. Fewer than max-args arguments will be used if the size (see the -s option) is exceeded, unless the -x option is given, in which case xargs will exit.

关于linux - 将具有模式的行转置为列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49106156/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com