Cut off the first two lines

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I'd like to retrive a list excluding the first 2 lines



$ pip list
Package Version
---------------------------------- ---------
alabaster 0.7.10
anaconda-client 1.6.9
anaconda-navigator 1.7.0
anaconda-project 0.8.2
appnope 0.1.0
appscript 1.0.1
asn1crypto 0.24.0
astroid 1.6.1
astropy 2.0.3
attrs 17.4.0


How to cut off the first two line like:



pip list | cut line=2






share|improve this question

















  • 1




    awk 'NR>2' file...
    – jasonwryan
    May 3 at 7:08














up vote
0
down vote

favorite












I'd like to retrive a list excluding the first 2 lines



$ pip list
Package Version
---------------------------------- ---------
alabaster 0.7.10
anaconda-client 1.6.9
anaconda-navigator 1.7.0
anaconda-project 0.8.2
appnope 0.1.0
appscript 1.0.1
asn1crypto 0.24.0
astroid 1.6.1
astropy 2.0.3
attrs 17.4.0


How to cut off the first two line like:



pip list | cut line=2






share|improve this question

















  • 1




    awk 'NR>2' file...
    – jasonwryan
    May 3 at 7:08












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'd like to retrive a list excluding the first 2 lines



$ pip list
Package Version
---------------------------------- ---------
alabaster 0.7.10
anaconda-client 1.6.9
anaconda-navigator 1.7.0
anaconda-project 0.8.2
appnope 0.1.0
appscript 1.0.1
asn1crypto 0.24.0
astroid 1.6.1
astropy 2.0.3
attrs 17.4.0


How to cut off the first two line like:



pip list | cut line=2






share|improve this question













I'd like to retrive a list excluding the first 2 lines



$ pip list
Package Version
---------------------------------- ---------
alabaster 0.7.10
anaconda-client 1.6.9
anaconda-navigator 1.7.0
anaconda-project 0.8.2
appnope 0.1.0
appscript 1.0.1
asn1crypto 0.24.0
astroid 1.6.1
astropy 2.0.3
attrs 17.4.0


How to cut off the first two line like:



pip list | cut line=2








share|improve this question












share|improve this question




share|improve this question








edited May 3 at 7:14









Inian

2,855722




2,855722









asked May 3 at 7:05









JawSaw

29410




29410







  • 1




    awk 'NR>2' file...
    – jasonwryan
    May 3 at 7:08












  • 1




    awk 'NR>2' file...
    – jasonwryan
    May 3 at 7:08







1




1




awk 'NR>2' file...
– jasonwryan
May 3 at 7:08




awk 'NR>2' file...
– jasonwryan
May 3 at 7:08










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










Simply with the sed command:



pip list | sed '1,2d'


Explanation: The sed command deletes (d) lines in the range 1 to 2 (and outputs everything else).



Or awk:



pip list | awk 'NR > 2'


Explanation: The awk program outputs everything on line 3 onwards.



awk would be particularly useful if you are planning to do further parsing of that output, such as extracting only the package names:



pip list | awk 'NR > 2 print $1 '



The cut command, that you mention in the question (disregarding that the semantics used is wrong), does not cut lines. Well, it does, but it cuts fields out of lines.






share|improve this answer























  • Actually, with GNU cut, one can do seq 20 | cut -d$'n' -f3-
    – Stéphane Chazelas
    May 3 at 7:47










  • @StéphaneChazelas That's treating the whole file as a n-delimited set of fields on a single line, so in a sense it's still cutting fields out of a line, but yes.
    – Kusalananda
    May 3 at 7:49










  • An advantage of using tail, beside the fact that it's going to be more efficient as it's the simple tool designed to that task is that with most implementations including non-GNU ones, it's going to work even on non-text input (like with very long lines, with NULs or sequences of bytes that don't form valid characters...), while several sed or awk implementations would choke on those.
    – Stéphane Chazelas
    May 3 at 7:50











  • @StéphaneChazelas The only reason I did not mention tail was that it is already mentioned in another answer.
    – Kusalananda
    May 3 at 8:06






  • 1




    Yes, I don't doubt that. Those comments were just additional notes, not a critique to your answer.
    – Stéphane Chazelas
    May 3 at 8:15

















up vote
6
down vote













Simply with tail command:



pip list | tail -n+3 -


  • from tail signature tail [OPTION]... [FILE]... - when FILE is -, read standard input


  • -n, --lines=[+]NUM - output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM





share|improve this answer























    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441473%2fcut-off-the-first-two-lines%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    Simply with the sed command:



    pip list | sed '1,2d'


    Explanation: The sed command deletes (d) lines in the range 1 to 2 (and outputs everything else).



    Or awk:



    pip list | awk 'NR > 2'


    Explanation: The awk program outputs everything on line 3 onwards.



    awk would be particularly useful if you are planning to do further parsing of that output, such as extracting only the package names:



    pip list | awk 'NR > 2 print $1 '



    The cut command, that you mention in the question (disregarding that the semantics used is wrong), does not cut lines. Well, it does, but it cuts fields out of lines.






    share|improve this answer























    • Actually, with GNU cut, one can do seq 20 | cut -d$'n' -f3-
      – Stéphane Chazelas
      May 3 at 7:47










    • @StéphaneChazelas That's treating the whole file as a n-delimited set of fields on a single line, so in a sense it's still cutting fields out of a line, but yes.
      – Kusalananda
      May 3 at 7:49










    • An advantage of using tail, beside the fact that it's going to be more efficient as it's the simple tool designed to that task is that with most implementations including non-GNU ones, it's going to work even on non-text input (like with very long lines, with NULs or sequences of bytes that don't form valid characters...), while several sed or awk implementations would choke on those.
      – Stéphane Chazelas
      May 3 at 7:50











    • @StéphaneChazelas The only reason I did not mention tail was that it is already mentioned in another answer.
      – Kusalananda
      May 3 at 8:06






    • 1




      Yes, I don't doubt that. Those comments were just additional notes, not a critique to your answer.
      – Stéphane Chazelas
      May 3 at 8:15














    up vote
    2
    down vote



    accepted










    Simply with the sed command:



    pip list | sed '1,2d'


    Explanation: The sed command deletes (d) lines in the range 1 to 2 (and outputs everything else).



    Or awk:



    pip list | awk 'NR > 2'


    Explanation: The awk program outputs everything on line 3 onwards.



    awk would be particularly useful if you are planning to do further parsing of that output, such as extracting only the package names:



    pip list | awk 'NR > 2 print $1 '



    The cut command, that you mention in the question (disregarding that the semantics used is wrong), does not cut lines. Well, it does, but it cuts fields out of lines.






    share|improve this answer























    • Actually, with GNU cut, one can do seq 20 | cut -d$'n' -f3-
      – Stéphane Chazelas
      May 3 at 7:47










    • @StéphaneChazelas That's treating the whole file as a n-delimited set of fields on a single line, so in a sense it's still cutting fields out of a line, but yes.
      – Kusalananda
      May 3 at 7:49










    • An advantage of using tail, beside the fact that it's going to be more efficient as it's the simple tool designed to that task is that with most implementations including non-GNU ones, it's going to work even on non-text input (like with very long lines, with NULs or sequences of bytes that don't form valid characters...), while several sed or awk implementations would choke on those.
      – Stéphane Chazelas
      May 3 at 7:50











    • @StéphaneChazelas The only reason I did not mention tail was that it is already mentioned in another answer.
      – Kusalananda
      May 3 at 8:06






    • 1




      Yes, I don't doubt that. Those comments were just additional notes, not a critique to your answer.
      – Stéphane Chazelas
      May 3 at 8:15












    up vote
    2
    down vote



    accepted







    up vote
    2
    down vote



    accepted






    Simply with the sed command:



    pip list | sed '1,2d'


    Explanation: The sed command deletes (d) lines in the range 1 to 2 (and outputs everything else).



    Or awk:



    pip list | awk 'NR > 2'


    Explanation: The awk program outputs everything on line 3 onwards.



    awk would be particularly useful if you are planning to do further parsing of that output, such as extracting only the package names:



    pip list | awk 'NR > 2 print $1 '



    The cut command, that you mention in the question (disregarding that the semantics used is wrong), does not cut lines. Well, it does, but it cuts fields out of lines.






    share|improve this answer















    Simply with the sed command:



    pip list | sed '1,2d'


    Explanation: The sed command deletes (d) lines in the range 1 to 2 (and outputs everything else).



    Or awk:



    pip list | awk 'NR > 2'


    Explanation: The awk program outputs everything on line 3 onwards.



    awk would be particularly useful if you are planning to do further parsing of that output, such as extracting only the package names:



    pip list | awk 'NR > 2 print $1 '



    The cut command, that you mention in the question (disregarding that the semantics used is wrong), does not cut lines. Well, it does, but it cuts fields out of lines.







    share|improve this answer















    share|improve this answer



    share|improve this answer








    edited May 3 at 8:26


























    answered May 3 at 7:16









    Kusalananda

    102k13199316




    102k13199316











    • Actually, with GNU cut, one can do seq 20 | cut -d$'n' -f3-
      – Stéphane Chazelas
      May 3 at 7:47










    • @StéphaneChazelas That's treating the whole file as a n-delimited set of fields on a single line, so in a sense it's still cutting fields out of a line, but yes.
      – Kusalananda
      May 3 at 7:49










    • An advantage of using tail, beside the fact that it's going to be more efficient as it's the simple tool designed to that task is that with most implementations including non-GNU ones, it's going to work even on non-text input (like with very long lines, with NULs or sequences of bytes that don't form valid characters...), while several sed or awk implementations would choke on those.
      – Stéphane Chazelas
      May 3 at 7:50











    • @StéphaneChazelas The only reason I did not mention tail was that it is already mentioned in another answer.
      – Kusalananda
      May 3 at 8:06






    • 1




      Yes, I don't doubt that. Those comments were just additional notes, not a critique to your answer.
      – Stéphane Chazelas
      May 3 at 8:15
















    • Actually, with GNU cut, one can do seq 20 | cut -d$'n' -f3-
      – Stéphane Chazelas
      May 3 at 7:47










    • @StéphaneChazelas That's treating the whole file as a n-delimited set of fields on a single line, so in a sense it's still cutting fields out of a line, but yes.
      – Kusalananda
      May 3 at 7:49










    • An advantage of using tail, beside the fact that it's going to be more efficient as it's the simple tool designed to that task is that with most implementations including non-GNU ones, it's going to work even on non-text input (like with very long lines, with NULs or sequences of bytes that don't form valid characters...), while several sed or awk implementations would choke on those.
      – Stéphane Chazelas
      May 3 at 7:50











    • @StéphaneChazelas The only reason I did not mention tail was that it is already mentioned in another answer.
      – Kusalananda
      May 3 at 8:06






    • 1




      Yes, I don't doubt that. Those comments were just additional notes, not a critique to your answer.
      – Stéphane Chazelas
      May 3 at 8:15















    Actually, with GNU cut, one can do seq 20 | cut -d$'n' -f3-
    – Stéphane Chazelas
    May 3 at 7:47




    Actually, with GNU cut, one can do seq 20 | cut -d$'n' -f3-
    – Stéphane Chazelas
    May 3 at 7:47












    @StéphaneChazelas That's treating the whole file as a n-delimited set of fields on a single line, so in a sense it's still cutting fields out of a line, but yes.
    – Kusalananda
    May 3 at 7:49




    @StéphaneChazelas That's treating the whole file as a n-delimited set of fields on a single line, so in a sense it's still cutting fields out of a line, but yes.
    – Kusalananda
    May 3 at 7:49












    An advantage of using tail, beside the fact that it's going to be more efficient as it's the simple tool designed to that task is that with most implementations including non-GNU ones, it's going to work even on non-text input (like with very long lines, with NULs or sequences of bytes that don't form valid characters...), while several sed or awk implementations would choke on those.
    – Stéphane Chazelas
    May 3 at 7:50





    An advantage of using tail, beside the fact that it's going to be more efficient as it's the simple tool designed to that task is that with most implementations including non-GNU ones, it's going to work even on non-text input (like with very long lines, with NULs or sequences of bytes that don't form valid characters...), while several sed or awk implementations would choke on those.
    – Stéphane Chazelas
    May 3 at 7:50













    @StéphaneChazelas The only reason I did not mention tail was that it is already mentioned in another answer.
    – Kusalananda
    May 3 at 8:06




    @StéphaneChazelas The only reason I did not mention tail was that it is already mentioned in another answer.
    – Kusalananda
    May 3 at 8:06




    1




    1




    Yes, I don't doubt that. Those comments were just additional notes, not a critique to your answer.
    – Stéphane Chazelas
    May 3 at 8:15




    Yes, I don't doubt that. Those comments were just additional notes, not a critique to your answer.
    – Stéphane Chazelas
    May 3 at 8:15












    up vote
    6
    down vote













    Simply with tail command:



    pip list | tail -n+3 -


    • from tail signature tail [OPTION]... [FILE]... - when FILE is -, read standard input


    • -n, --lines=[+]NUM - output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM





    share|improve this answer



























      up vote
      6
      down vote













      Simply with tail command:



      pip list | tail -n+3 -


      • from tail signature tail [OPTION]... [FILE]... - when FILE is -, read standard input


      • -n, --lines=[+]NUM - output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM





      share|improve this answer

























        up vote
        6
        down vote










        up vote
        6
        down vote









        Simply with tail command:



        pip list | tail -n+3 -


        • from tail signature tail [OPTION]... [FILE]... - when FILE is -, read standard input


        • -n, --lines=[+]NUM - output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM





        share|improve this answer















        Simply with tail command:



        pip list | tail -n+3 -


        • from tail signature tail [OPTION]... [FILE]... - when FILE is -, read standard input


        • -n, --lines=[+]NUM - output the last NUM lines, instead of the last 10; or use -n +NUM to output starting with line NUM






        share|improve this answer















        share|improve this answer



        share|improve this answer








        edited May 3 at 7:20


























        answered May 3 at 7:11









        RomanPerekhrest

        22.4k12144




        22.4k12144






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441473%2fcut-off-the-first-two-lines%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay