我有一个名为 的文件file1
,其中包含以下几行
you are searching for a four .
you are searching for a six .
you are searching for a three .
you are searching for an ace .
you are searching for an eight .
you can use empty spaces in the Tab@@ le@@ au to move multiple cards . be careful with K@@ ings in the Reserve : the only way to remove them is by playing them to a Foundation on top of a Queen .
you can use empty spaces in the Tab@@ le@@ au to move multiple cards . be careful with K@@ ings in the Reserve : the only way to remove them is by playing them to a Foundation on top of a Queen .
我有第二个文件file2
用这些行调用
four|||Vier
six|||Se@@ chs
for|||nach
searching|||suchen
eight|||Acht
spaces|||Plätze
spaces|||Plätze spaces|||Plätze
但是,在我执行了通过 Unix paste 合并这些行的命令之后
paste file1 file2 > result
我得到这样的结果:
you are four|||Vieror a four .
you are six|||Se@@ chsa six .
you are for|||nachfor a three .
you are searching|||suchence .
you are eight|||Achtr an eight .
you can use empty spaces in the Tab@@ le@@ au to move multiple cards . be careful with K@@ ings in the Reserve : the only way to remove them is by playing them to a Fouspaces|||Plätzeof a Queen .
you can use empty spaces in the Tab@@ le@@ au to move multiple cards . be careful with K@@ ings in the Reserve : the only way to remove them is by playing them to a Foundation on top of a Queen . spaces|||Plätze spaces|||Plätze
我不明白发生了什么。为什么每个文件的合并行重叠?
我猜至少
file1
是一个DOS文本文件。在 Unix 系统上使用时,此类文件中的每一行末尾都会有一个额外的回车符。当它被打印到终端时,这个回车字符将光标带回到行首。在两个文件的数据之间插入的制表符paste
将光标向右移动八个字符。然后,第二个文件中的文本会覆盖该行的内容,从而产生您看到的乱码输出。您可能希望使用以下工具转换文本文件
dos2unix
(这也可以正确地将文件从常见的 Windows 文本编码转换为 Unix 上更常用的编码等)