remove comma from a specific portion of a long string
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I have document contain very long strings represent decoded information, i want to remove ,
commas from the last portion of the string. For example this is one of the long strings:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
I want to remove comma from the last portion of it so let me zoom in to show you how it look like:
(99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
so the final result look like this:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:
(99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!
text-processing
add a comment |Â
up vote
4
down vote
favorite
I have document contain very long strings represent decoded information, i want to remove ,
commas from the last portion of the string. For example this is one of the long strings:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
I want to remove comma from the last portion of it so let me zoom in to show you how it look like:
(99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
so the final result look like this:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:
(99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!
text-processing
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I have document contain very long strings represent decoded information, i want to remove ,
commas from the last portion of the string. For example this is one of the long strings:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
I want to remove comma from the last portion of it so let me zoom in to show you how it look like:
(99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
so the final result look like this:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:
(99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!
text-processing
I have document contain very long strings represent decoded information, i want to remove ,
commas from the last portion of the string. For example this is one of the long strings:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
I want to remove comma from the last portion of it so let me zoom in to show you how it look like:
(99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);
so the final result look like this:
Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:
(99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);
I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!
text-processing
text-processing
edited 54 mins ago
Jeff Schaller
33.8k851113
33.8k851113
asked 1 hour ago
Zahi
171111
171111
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
awk -F' -vOFS=' 'gsub(","," ",$2); print'
Nice solution. Just one bug : it will work only with lines having one'...,...'
field.
â George Vasiliou
22 mins ago
add a comment |Â
up vote
2
down vote
Alternative solution with gnu sed
:
sed -r 's/(x27.*),(.*x27)/1 2/g' file
x27
: ascii code of single quote '
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
awk -F' -vOFS=' 'gsub(","," ",$2); print'
Nice solution. Just one bug : it will work only with lines having one'...,...'
field.
â George Vasiliou
22 mins ago
add a comment |Â
up vote
4
down vote
accepted
awk -F' -vOFS=' 'gsub(","," ",$2); print'
Nice solution. Just one bug : it will work only with lines having one'...,...'
field.
â George Vasiliou
22 mins ago
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
awk -F' -vOFS=' 'gsub(","," ",$2); print'
awk -F' -vOFS=' 'gsub(","," ",$2); print'
answered 1 hour ago
Goro
7,94153777
7,94153777
Nice solution. Just one bug : it will work only with lines having one'...,...'
field.
â George Vasiliou
22 mins ago
add a comment |Â
Nice solution. Just one bug : it will work only with lines having one'...,...'
field.
â George Vasiliou
22 mins ago
Nice solution. Just one bug : it will work only with lines having one
'...,...'
field.â George Vasiliou
22 mins ago
Nice solution. Just one bug : it will work only with lines having one
'...,...'
field.â George Vasiliou
22 mins ago
add a comment |Â
up vote
2
down vote
Alternative solution with gnu sed
:
sed -r 's/(x27.*),(.*x27)/1 2/g' file
x27
: ascii code of single quote '
add a comment |Â
up vote
2
down vote
Alternative solution with gnu sed
:
sed -r 's/(x27.*),(.*x27)/1 2/g' file
x27
: ascii code of single quote '
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Alternative solution with gnu sed
:
sed -r 's/(x27.*),(.*x27)/1 2/g' file
x27
: ascii code of single quote '
Alternative solution with gnu sed
:
sed -r 's/(x27.*),(.*x27)/1 2/g' file
x27
: ascii code of single quote '
answered 15 mins ago
George Vasiliou
5,34031027
5,34031027
add a comment |Â
add a comment |Â
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%2f474357%2fremove-comma-from-a-specific-portion-of-a-long-string%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