Paste two text lists (one list a file) into one list separated by semicolon

北战南征 提交于 2019-11-28 00:56:19

问题


An example of the process/output would be:

File1:

hello
world

File2:

foo
bar

Resulting file after concatenation:

File3:

hello;foo
world;bar

For a large list of non-predictive text (no-wild cards - but lines are aligned as above).

I cannot figure out how to do this with the paste command under Ubuntu.


回答1:


paste -d';' File1 File2  >  File3



回答2:


cat concatenates by lines (or, more accurately, doesn't care what the contents are).

What you seem to need is something more like paste.

$ paste -d\; file1 file2
hello;foo
world;bar


来源:https://stackoverflow.com/questions/1584559/paste-two-text-lists-one-list-a-file-into-one-list-separated-by-semicolon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!