Retrieve the first few lines from testing result with head -n





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I am testing a python program and desire to retrieve its first two lines of results



$ python twoSum.py  
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 151
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 194
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 247
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 192
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 206
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 171
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 170
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 190
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 132
DEBUG-MainProcess:31921-MainThread:140190102726464 j: 63
[8, 63]
.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK


Employ head to tackle the text



$ python twoSum.py  | head -n 1
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 259
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 235
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 133
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 274
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 265
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 257
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 280
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 134
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 138
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 145
DEBUG-MainProcess:31978-MainThread:140699277834048 j: 75
.
----------------------------------------------------------------------
Ran 1 test in 0.001s


It does not work,

How could I retrieve the first few lines which I want to see.










share|improve this question

























  • could you please transmit the comment to answer. @steeldriver

    – JawSaw
    Mar 21 at 2:36


















0















I am testing a python program and desire to retrieve its first two lines of results



$ python twoSum.py  
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 151
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 194
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 247
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 192
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 206
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 171
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 170
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 190
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 132
DEBUG-MainProcess:31921-MainThread:140190102726464 j: 63
[8, 63]
.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK


Employ head to tackle the text



$ python twoSum.py  | head -n 1
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 259
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 235
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 133
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 274
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 265
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 257
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 280
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 134
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 138
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 145
DEBUG-MainProcess:31978-MainThread:140699277834048 j: 75
.
----------------------------------------------------------------------
Ran 1 test in 0.001s


It does not work,

How could I retrieve the first few lines which I want to see.










share|improve this question

























  • could you please transmit the comment to answer. @steeldriver

    – JawSaw
    Mar 21 at 2:36














0












0








0








I am testing a python program and desire to retrieve its first two lines of results



$ python twoSum.py  
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 151
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 194
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 247
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 192
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 206
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 171
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 170
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 190
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 132
DEBUG-MainProcess:31921-MainThread:140190102726464 j: 63
[8, 63]
.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK


Employ head to tackle the text



$ python twoSum.py  | head -n 1
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 259
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 235
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 133
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 274
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 265
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 257
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 280
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 134
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 138
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 145
DEBUG-MainProcess:31978-MainThread:140699277834048 j: 75
.
----------------------------------------------------------------------
Ran 1 test in 0.001s


It does not work,

How could I retrieve the first few lines which I want to see.










share|improve this question
















I am testing a python program and desire to retrieve its first two lines of results



$ python twoSum.py  
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 151
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 194
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 247
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 192
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 206
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 171
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 170
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 190
DEBUG-MainProcess:31921-MainThread:140190102726464 j: None
DEBUG-MainProcess:31921-MainThread:140190102726464 find: 132
DEBUG-MainProcess:31921-MainThread:140190102726464 j: 63
[8, 63]
.
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK


Employ head to tackle the text



$ python twoSum.py  | head -n 1
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 259
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 235
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 133
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 274
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 265
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 257
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 280
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 134
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 138
DEBUG-MainProcess:31978-MainThread:140699277834048 j: None
DEBUG-MainProcess:31978-MainThread:140699277834048 find: 145
DEBUG-MainProcess:31978-MainThread:140699277834048 j: 75
.
----------------------------------------------------------------------
Ran 1 test in 0.001s


It does not work,

How could I retrieve the first few lines which I want to see.







bash python3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 2:26







JawSaw

















asked Mar 21 at 2:20









JawSawJawSaw

445315




445315













  • could you please transmit the comment to answer. @steeldriver

    – JawSaw
    Mar 21 at 2:36



















  • could you please transmit the comment to answer. @steeldriver

    – JawSaw
    Mar 21 at 2:36

















could you please transmit the comment to answer. @steeldriver

– JawSaw
Mar 21 at 2:36





could you please transmit the comment to answer. @steeldriver

– JawSaw
Mar 21 at 2:36










1 Answer
1






active

oldest

votes


















1














Likely the DEBUG- outputs are going to the standard error stream rather than the standard output stream - try



python twoSum.py 2>&1 | head -n 1 


to redirect stderr (file descriptor #2) to stdout (file descriptor #1); or (bash shorthand)



python twoSum.py |& head -n 1


For further information see the related question Using grep with pipe and ampersand to filter errors from find.






share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "89"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1127410%2fretrieve-the-first-few-lines-from-testing-result-with-head-n%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Likely the DEBUG- outputs are going to the standard error stream rather than the standard output stream - try



    python twoSum.py 2>&1 | head -n 1 


    to redirect stderr (file descriptor #2) to stdout (file descriptor #1); or (bash shorthand)



    python twoSum.py |& head -n 1


    For further information see the related question Using grep with pipe and ampersand to filter errors from find.






    share|improve this answer




























      1














      Likely the DEBUG- outputs are going to the standard error stream rather than the standard output stream - try



      python twoSum.py 2>&1 | head -n 1 


      to redirect stderr (file descriptor #2) to stdout (file descriptor #1); or (bash shorthand)



      python twoSum.py |& head -n 1


      For further information see the related question Using grep with pipe and ampersand to filter errors from find.






      share|improve this answer


























        1












        1








        1







        Likely the DEBUG- outputs are going to the standard error stream rather than the standard output stream - try



        python twoSum.py 2>&1 | head -n 1 


        to redirect stderr (file descriptor #2) to stdout (file descriptor #1); or (bash shorthand)



        python twoSum.py |& head -n 1


        For further information see the related question Using grep with pipe and ampersand to filter errors from find.






        share|improve this answer













        Likely the DEBUG- outputs are going to the standard error stream rather than the standard output stream - try



        python twoSum.py 2>&1 | head -n 1 


        to redirect stderr (file descriptor #2) to stdout (file descriptor #1); or (bash shorthand)



        python twoSum.py |& head -n 1


        For further information see the related question Using grep with pipe and ampersand to filter errors from find.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 21 at 2:40









        steeldriversteeldriver

        70.6k11115187




        70.6k11115187






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1127410%2fretrieve-the-first-few-lines-from-testing-result-with-head-n%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How did Captain America manage to do this?

            迪纳利

            南乌拉尔铁路局