removing digits from the end of lines in text file
Clash 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
bash
New contributor
add a comment |Â
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
bash
New contributor
add a comment |Â
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
bash
New contributor
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
bash
New contributor
New contributor
New contributor
asked 5 mins ago
Ben
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I would use sed
for this task:
sed 's/.8$//' file
add a comment |Â
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
add a comment |Â
up vote
0
down vote
I would use sed
for this task:
sed 's/.8$//' file
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I would use sed
for this task:
sed 's/.8$//' file
I would use sed
for this task:
sed 's/.8$//' file
answered 1 min ago
Goro
8,85564385
8,85564385
add a comment |Â
add a comment |Â
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.
Ben is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password