awk remove lines with digits at end

Multi tool use
Multi tool use

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











up vote
0
down vote

favorite












I want to remove lines with digits at the end of the string,



example of input:



example123
example
example12
example43


expected output:



example






share|improve this question

















  • 2




    Digits or digit? (How many qualify for removal?)
    – Jeff Schaller
    May 8 at 19:07






  • 2




    Possible duplicate of sed remove digits from end of stirng
    – Kusalananda
    May 9 at 9:30






  • 1




    @Kusalananda and those seeing a VTC duplicate to unix.stackexchange.com/questions/432332/…, it sounds to me like they want to remove/delete lines that end in digits, not "remove just the digits"
    – Jeff Schaller
    May 9 at 11:00






  • 1




    I still want to know how many digits (s being used twice in the Q/title) are needed at the end to remove the line; 1, or more?
    – Jeff Schaller
    May 9 at 11:01














up vote
0
down vote

favorite












I want to remove lines with digits at the end of the string,



example of input:



example123
example
example12
example43


expected output:



example






share|improve this question

















  • 2




    Digits or digit? (How many qualify for removal?)
    – Jeff Schaller
    May 8 at 19:07






  • 2




    Possible duplicate of sed remove digits from end of stirng
    – Kusalananda
    May 9 at 9:30






  • 1




    @Kusalananda and those seeing a VTC duplicate to unix.stackexchange.com/questions/432332/…, it sounds to me like they want to remove/delete lines that end in digits, not "remove just the digits"
    – Jeff Schaller
    May 9 at 11:00






  • 1




    I still want to know how many digits (s being used twice in the Q/title) are needed at the end to remove the line; 1, or more?
    – Jeff Schaller
    May 9 at 11:01












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to remove lines with digits at the end of the string,



example of input:



example123
example
example12
example43


expected output:



example






share|improve this question













I want to remove lines with digits at the end of the string,



example of input:



example123
example
example12
example43


expected output:



example








share|improve this question












share|improve this question




share|improve this question








edited May 8 at 19:06









Jeff Schaller

31.1k846105




31.1k846105









asked May 8 at 18:59









awk

41




41







  • 2




    Digits or digit? (How many qualify for removal?)
    – Jeff Schaller
    May 8 at 19:07






  • 2




    Possible duplicate of sed remove digits from end of stirng
    – Kusalananda
    May 9 at 9:30






  • 1




    @Kusalananda and those seeing a VTC duplicate to unix.stackexchange.com/questions/432332/…, it sounds to me like they want to remove/delete lines that end in digits, not "remove just the digits"
    – Jeff Schaller
    May 9 at 11:00






  • 1




    I still want to know how many digits (s being used twice in the Q/title) are needed at the end to remove the line; 1, or more?
    – Jeff Schaller
    May 9 at 11:01












  • 2




    Digits or digit? (How many qualify for removal?)
    – Jeff Schaller
    May 8 at 19:07






  • 2




    Possible duplicate of sed remove digits from end of stirng
    – Kusalananda
    May 9 at 9:30






  • 1




    @Kusalananda and those seeing a VTC duplicate to unix.stackexchange.com/questions/432332/…, it sounds to me like they want to remove/delete lines that end in digits, not "remove just the digits"
    – Jeff Schaller
    May 9 at 11:00






  • 1




    I still want to know how many digits (s being used twice in the Q/title) are needed at the end to remove the line; 1, or more?
    – Jeff Schaller
    May 9 at 11:01







2




2




Digits or digit? (How many qualify for removal?)
– Jeff Schaller
May 8 at 19:07




Digits or digit? (How many qualify for removal?)
– Jeff Schaller
May 8 at 19:07




2




2




Possible duplicate of sed remove digits from end of stirng
– Kusalananda
May 9 at 9:30




Possible duplicate of sed remove digits from end of stirng
– Kusalananda
May 9 at 9:30




1




1




@Kusalananda and those seeing a VTC duplicate to unix.stackexchange.com/questions/432332/…, it sounds to me like they want to remove/delete lines that end in digits, not "remove just the digits"
– Jeff Schaller
May 9 at 11:00




@Kusalananda and those seeing a VTC duplicate to unix.stackexchange.com/questions/432332/…, it sounds to me like they want to remove/delete lines that end in digits, not "remove just the digits"
– Jeff Schaller
May 9 at 11:00




1




1




I still want to know how many digits (s being used twice in the Q/title) are needed at the end to remove the line; 1, or more?
– Jeff Schaller
May 9 at 11:01




I still want to know how many digits (s being used twice in the Q/title) are needed at the end to remove the line; 1, or more?
– Jeff Schaller
May 9 at 11:01










3 Answers
3






active

oldest

votes

















up vote
3
down vote













Very simple to do:



awk '/[^0-9]$/ print ' inputfile


Or, if you care to preserve empty lines,



awk '! /[0-9]$/ print ' inputfile





share|improve this answer






























    up vote
    1
    down vote













    Or in case you are interested in grep too, following simple grep may help also.



    grep -v '[0-9]$' Input_file





    share|improve this answer




























      up vote
      1
      down vote













      sed -e '/[0-9]$/d' input-file.txt





      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%2f442615%2fawk-remove-lines-with-digits-at-end%23new-answer', 'question_page');

        );

        Post as a guest






























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        3
        down vote













        Very simple to do:



        awk '/[^0-9]$/ print ' inputfile


        Or, if you care to preserve empty lines,



        awk '! /[0-9]$/ print ' inputfile





        share|improve this answer



























          up vote
          3
          down vote













          Very simple to do:



          awk '/[^0-9]$/ print ' inputfile


          Or, if you care to preserve empty lines,



          awk '! /[0-9]$/ print ' inputfile





          share|improve this answer

























            up vote
            3
            down vote










            up vote
            3
            down vote









            Very simple to do:



            awk '/[^0-9]$/ print ' inputfile


            Or, if you care to preserve empty lines,



            awk '! /[0-9]$/ print ' inputfile





            share|improve this answer















            Very simple to do:



            awk '/[^0-9]$/ print ' inputfile


            Or, if you care to preserve empty lines,



            awk '! /[0-9]$/ print ' inputfile






            share|improve this answer















            share|improve this answer



            share|improve this answer








            edited May 8 at 20:08


























            answered May 8 at 19:00









            DopeGhoti

            40k54779




            40k54779






















                up vote
                1
                down vote













                Or in case you are interested in grep too, following simple grep may help also.



                grep -v '[0-9]$' Input_file





                share|improve this answer

























                  up vote
                  1
                  down vote













                  Or in case you are interested in grep too, following simple grep may help also.



                  grep -v '[0-9]$' Input_file





                  share|improve this answer























                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    Or in case you are interested in grep too, following simple grep may help also.



                    grep -v '[0-9]$' Input_file





                    share|improve this answer













                    Or in case you are interested in grep too, following simple grep may help also.



                    grep -v '[0-9]$' Input_file






                    share|improve this answer













                    share|improve this answer



                    share|improve this answer











                    answered May 9 at 0:54









                    RavinderSingh13

                    1235




                    1235




















                        up vote
                        1
                        down vote













                        sed -e '/[0-9]$/d' input-file.txt





                        share|improve this answer

























                          up vote
                          1
                          down vote













                          sed -e '/[0-9]$/d' input-file.txt





                          share|improve this answer























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            sed -e '/[0-9]$/d' input-file.txt





                            share|improve this answer













                            sed -e '/[0-9]$/d' input-file.txt






                            share|improve this answer













                            share|improve this answer



                            share|improve this answer











                            answered May 9 at 3:52









                            Rakesh Sharma

                            413




                            413






















                                 

                                draft saved


                                draft discarded


























                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442615%2fawk-remove-lines-with-digits-at-end%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                8CD8AkPVajySoVvOkEvHn fPknbfDnwmTSurgw4Q dbJGCqzc1k2bBfQ,Mlk
                                9DoiLbvJB,FwWXQXthzOY0jAHWoXKT WI30 qybpDX1MaQ0Kf4iI 2IZR lhr93Cbk

                                Popular posts from this blog

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

                                How many registers does an x86_64 CPU actually have?

                                Displaying single band from multi-band raster using QGIS