removing digits from the end of lines in text file

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











up vote
0
down vote

favorite












I have this sample from a log file which is driving me crazy. i want to remove the last 8 digits but the problem there are colons in different places so I tried awk but it didn't work. this is the content of the file:



L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:09809898785
L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:098767894
L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:987656788903
L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:0987656797
D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:000050009
D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:000060003
D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:000070005
D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:0000800047
D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:0000900049
D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:0001100044
C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:00065000465783
C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:00066000346635
C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:00067000343438
C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:00068000345549
C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:00069000565449
C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:0987678787
P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:87656787906
P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:3245667855
P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:9098765563
P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:9876545673
TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:000750005673


The required output like this text:



L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:098
L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:0
L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:9876
L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:09
D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:0
D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:0
D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:0
D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:00
D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:00
D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:00
C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:000650
C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:000660
C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:000670
C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:000680
C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:000690
C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:09
P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:876
P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:32
P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:90
P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:98
TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:0007


Any help is appreciated thanks!
have a good night!
Ben









share







New contributor




Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    0
    down vote

    favorite












    I have this sample from a log file which is driving me crazy. i want to remove the last 8 digits but the problem there are colons in different places so I tried awk but it didn't work. this is the content of the file:



    L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:09809898785
    L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:098767894
    L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:987656788903
    L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:0987656797
    D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:000050009
    D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:000060003
    D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:000070005
    D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:0000800047
    D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:0000900049
    D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:0001100044
    C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:00065000465783
    C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:00066000346635
    C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:00067000343438
    C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:00068000345549
    C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:00069000565449
    C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:0987678787
    P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:87656787906
    P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:3245667855
    P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:9098765563
    P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:9876545673
    TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:000750005673


    The required output like this text:



    L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:098
    L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:0
    L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:9876
    L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:09
    D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:0
    D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:0
    D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:0
    D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:00
    D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:00
    D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:00
    C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:000650
    C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:000660
    C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:000670
    C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:000680
    C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:000690
    C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:09
    P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:876
    P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:32
    P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:90
    P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:98
    TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:0007


    Any help is appreciated thanks!
    have a good night!
    Ben









    share







    New contributor




    Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have this sample from a log file which is driving me crazy. i want to remove the last 8 digits but the problem there are colons in different places so I tried awk but it didn't work. this is the content of the file:



      L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:09809898785
      L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:098767894
      L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:987656788903
      L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:0987656797
      D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:000050009
      D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:000060003
      D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:000070005
      D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:0000800047
      D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:0000900049
      D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:0001100044
      C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:00065000465783
      C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:00066000346635
      C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:00067000343438
      C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:00068000345549
      C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:00069000565449
      C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:0987678787
      P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:87656787906
      P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:3245667855
      P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:9098765563
      P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:9876545673
      TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:000750005673


      The required output like this text:



      L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:098
      L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:0
      L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:9876
      L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:09
      D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:0
      D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:0
      D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:0
      D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:00
      D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:00
      D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:00
      C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:000650
      C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:000660
      C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:000670
      C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:000680
      C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:000690
      C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:09
      P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:876
      P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:32
      P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:90
      P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:98
      TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:0007


      Any help is appreciated thanks!
      have a good night!
      Ben









      share







      New contributor




      Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have this sample from a log file which is driving me crazy. i want to remove the last 8 digits but the problem there are colons in different places so I tried awk but it didn't work. this is the content of the file:



      L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:09809898785
      L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:098767894
      L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:987656788903
      L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:0987656797
      D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:000050009
      D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:000060003
      D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:000070005
      D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:0000800047
      D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:0000900049
      D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:0001100044
      C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:00065000465783
      C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:00066000346635
      C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:00067000343438
      C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:00068000345549
      C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:00069000565449
      C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:0987678787
      P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:87656787906
      P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:3245667855
      P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:9098765563
      P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:9876545673
      TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:000750005673


      The required output like this text:



      L258A:lp=L258:sd=LXXXK.S11:qt=text:00001000,mgfgfhghjk:098
      L258B:lp=L258:sd=LXXXK.S11:qt=raw:00002000lkjhgfdgfhghjk:0
      L629A:lp=L629:sd=LXXXK.S11:qt=text:00003000oiuytyuiup:9876
      L629B:lp=L629:sd=LXXXK.S11:qt=raw:00004000kljhkl;lkjhlk:09
      D206:rm=WXXBQ9Q2:rp=P11111PLD19L206DRAFT$:qt=auto:qg=107:0
      D208:rm=WXXBQ9Q2:rp=P11111PLD19L208DRAFT$:qt=auto:qg=107:0
      D210:rm=WXXBQ9Q2:rp=P11111PLD19L210DRAFT$:qt=auto:qg=107:0
      D254:rm=NXXQ9QG:rp=P11111PLD19L254DRAFT$:qt=auto:qg=143:00
      D255:rm=NXXQ9QG:rp=P11111PLD19L255DRAFT$:qt=auto:qg=143:00
      D257:rm=NXXXQQG:rp=P11111PLD19L257DRAFT$:qt=auto:qg=143:00
      C783:rm=WXSBQ9QF:rp=P11111PLD19L783$:qt=auto:qg=139:000650
      C545:rm=WXSBQ9Q6:rp=P11111PLD19L545$:qt=auto:qg=133:000660
      C546:rm=WXSBQ9Q6:rp=P11111PLD19L546$:qt=auto:qg=133:000670
      C547:rm=WXSBQ9Q6:rp=P11111PLD19L547$:qt=addd:qg=133:000680
      C548:rm=WXSBQ9Q6:rp=P11111PLD19L548$:qt=asss:qg=133:000690
      C256:rm=WXSBTQ75:rp=P11111PLD19L256$:qt=auto:qg=208:jkk:09
      P221A:lp=P221:sd=L003K.111:qt=text:00071000asdkjasdue8:876
      P221B:lp=P221:sd=L003K.111:qt=raw:00072000dsfdghdfsafgg:32
      P301A:lp=P301:sd=L003K.111:qt=text:00073000kjhgcbvbmnlo:90
      P301B:lp=P301:sd=L003K.111:qt=raw:00074000poiuhgtyreewr:98
      TRRR:rm=AUxxxbM:rp=TRMS:cl=|writer=%f|jobn=%j:qt=cctl:0007


      Any help is appreciated thanks!
      have a good night!
      Ben







      bash





      share







      New contributor




      Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 mins ago









      Ben

      1




      1




      New contributor




      Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Ben is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I would use sed for this task:



          sed 's/.8$//' file




          share




















            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
            );



            );






            Ben is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475213%2fremoving-digits-from-the-end-of-lines-in-text-file%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            I would use sed for this task:



            sed 's/.8$//' file




            share
























              up vote
              0
              down vote













              I would use sed for this task:



              sed 's/.8$//' file




              share






















                up vote
                0
                down vote










                up vote
                0
                down vote









                I would use sed for this task:



                sed 's/.8$//' file




                share












                I would use sed for this task:



                sed 's/.8$//' file





                share











                share


                share










                answered 1 min ago









                Goro

                8,85564385




                8,85564385




















                    Ben is a new contributor. Be nice, and check out our Code of Conduct.









                     

                    draft saved


                    draft discarded


















                    Ben is a new contributor. Be nice, and check out our Code of Conduct.












                    Ben is a new contributor. Be nice, and check out our Code of Conduct.











                    Ben is a new contributor. Be nice, and check out our Code of Conduct.













                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475213%2fremoving-digits-from-the-end-of-lines-in-text-file%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?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?