linux – 成对的不同文件中所有可能的单词排列
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux – 成对的不同文件中所有可能的单词排列,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含843字,纯文字阅读大概需要2分钟。
内容图文
![linux – 成对的不同文件中所有可能的单词排列](/upload/InfoBanner/zyjiaocheng/957/27101f17d8ac432c979785a467b3b8dd.jpg)
我有多个文件,比方说file1,file2等.每个文件在每一行都有一个单词,如:
file1 file2 file3
one four six
two five
three
我想要的是将它们组合成一个新的文件4,每个可能的排列(不重复)成对.喜欢
onetwo
onethree
onefour
onefive
...
twothree
...
onefour
...
fourone
...
如何使用Linux命令实现这一点?
解决方法:
用这个:
cat FILE1 FILE2 FILE3 | perl -lne 'BEGIN{@a}{push @a,$_}END{foreach $x(@a){foreach $y(@a){print $x.$y}}}'
输出:
oneone
onetwo
onethree
onefour
onefive
onesix
oneseven
twoone
twotwo
twothree
twofour
twofive
twosix
twoseven
threeone
threetwo
threethree
threefour
threefive
threesix
threeseven
fourone
fourtwo
fourthree
fourfour
fourfive
foursix
fourseven
fiveone
fivetwo
fivethree
fivefour
fivefive
fivesix
fiveseven
sixone
sixtwo
sixthree
sixfour
sixfive
sixsix
sixseven
sevenone
seventwo
seventhree
sevenfour
sevenfive
sevensix
sevenseven
内容总结
以上是互联网集市为您收集整理的linux – 成对的不同文件中所有可能的单词排列全部内容,希望文章能够帮你解决linux – 成对的不同文件中所有可能的单词排列所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。
来源:【匿名】