Linux或Mac:合并来自不同文件的列会混合列

时间:2016-05-26 17:04:12

标签: linux

我正在尝试使用" paste"命令合并来自少数文件的列,但它会导致错误合并,如下所示。我感谢您的帮助。

File1.csv

A 2

B 3

C 4

File2.csv

AA 6

BB 8

CC 2

输出预期(必填):

A 2 AA 6

乙3 BB 8

的C 4 CC 2

我使用的命令

paste File1.csv File2.csv > output.csv

也用过

paste -d'\t' File1.csv File2.csv > output.csv

output.csv (我收到错误的输出):

A 2
    AA 6

乙3
    BB 8

的C 4
    CC 2

感谢。我感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

@shellter解决方案在使用“ dos2unix”命令时效果很好。


    <body>
            <p id="textField">You can translate the content of this page by selecting a language in the select box.</p>
            <h1 id="title">My Web Page</h1>
            <p >Hello everybody!</p>
            <p>Translate this page:</p>
            <form>
                <select id="targetLanguage">
                    <option value="ZH">Chinese (Mandarin)</option>
                    <option value="CS">Czech</option>
                    <option value="DA">Danish</option>
                    <option value="NL">Dutch</option>
                    <option value="EN">English</option>
                    <option value="ET">Estonian</option>
                    <option value="TR" selected = "selected">French</option>
                </select>

                <input type="button" id="translateButton" value="Translate" />
            </form>

            <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
            <script type="text/javascript">

                $("#translateButton").click(function () {

                    var url = "https://translation.googleapis.com/language/translate/v2";
                    //Strings requiring translation
                    url += "?q=" + escape($("#textField").text());
                    url += "&q=" + escape($("#title").text());
                    //Target language
                    url += "&target=" + $("#targetLanguage").val();
                    //Replace with your API key
                    url += "&key=AIzaSyBm6-QqyT7_OcJp03BIPZhgfp-xB0GxOb0";
                    console.log(url);
                    $.get(url, function (data, status) {
                        //Results are returned in an array following the order they were passed. 
                        $("#textField").text(data.data.translations[0].translatedText);
                        $("#title").text(data.data.translations[1].translatedText);
                    });       
                });
            </script>  
        </body>