【发布时间】:2017-10-04 18:36:56
【问题描述】:
好吧,我又为你们中的一位出色的巫师带来了另一个没有脑子的东西,我一直在玩 awk,但还没有完全弄清楚这一点。因此,事不宜迟,这就是我要解决的问题。
我有两个文件
file1 看起来像这样(实际文件有数百行 w 随机单词)
somewebsite
someotherwebsite
somestinking
blahblah
foobar
file2 看起来像这样(许多 tld,更多)
.com.th
.co.uk
.com
.de
.ath.cx
好的,我需要 file1 中的每一行将每个 tld 从 file2 添加到一个新行上......
更详细地说,需要复制 file1 中的每一行,以便可以将 file2 中的每个 tld 添加到 file1 中的每个条目。
输出应该是这样的:
somewebsite.com.th
somewebsite.co.uk
somewebsite.com
somewebsite.de
somewebsite.ath.cx
someotherwebsite.com.th
someotherwebsite.co.uk
someotherwebsite.com
someotherwebsite.de
someotherwebsite.ath.cx
somestinking.com.th
somestinking.co.uk
somestinking.com
somestinking.de
somestinking.ath.cx
blahblah.com.th
blahblah.co.uk
blahblah.com
blahblah.de
blahblah.ath.cx
foobar.com.th
foobar.co.uk
foobar.com
foobar.de
foobar.ath.cx
我希望这对某人有意义,我试图弄清楚如何去做,这当然很有趣我失败的所有方式。
提前谢谢你。我确信我不是唯一一个现在、过去或将来尝试过这个的人,所以一个解决方案肯定会帮助下一个尝试这样做的人。
【问题讨论】:
-
您应该:1.) 添加您的代码,或者 2.) 只是说:我很懒,所以为我编写一个脚本。
-
我真的在寻求帮助。那些类型的评论是不必要的。
-
您应该阅读help center。在这里,我们帮助开发人员克服工作中的问题。您没有发布任何可以称为“工作”的内容,因此您甚至没有尝试解决问题。因此,您只是要求免费的开发人员工作,却错过了网站的重点。