awk - replace number greater than 17 digits in a column with -
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I have a CSV file containing timestamp values in UTC which I need to replace with -
. There may be more than one timestamp in the same column, can you please let me know how do I do that?
For example, this is one column in a CSV file:
+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0
The output should look like:
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
awk variable-substitution
New contributor
add a comment |Â
up vote
2
down vote
favorite
I have a CSV file containing timestamp values in UTC which I need to replace with -
. There may be more than one timestamp in the same column, can you please let me know how do I do that?
For example, this is one column in a CSV file:
+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0
The output should look like:
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
awk variable-substitution
New contributor
Can you show an example of âÂÂmore than one timestamp in the same column âÂÂ?
â Jeff Schaller
1 hour ago
1
Re-reading your question, are you perhaps mixing up the terms row and column?
â Jeff Schaller
58 mins ago
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I have a CSV file containing timestamp values in UTC which I need to replace with -
. There may be more than one timestamp in the same column, can you please let me know how do I do that?
For example, this is one column in a CSV file:
+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0
The output should look like:
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
awk variable-substitution
New contributor
I have a CSV file containing timestamp values in UTC which I need to replace with -
. There may be more than one timestamp in the same column, can you please let me know how do I do that?
For example, this is one column in a CSV file:
+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0
The output should look like:
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
awk variable-substitution
awk variable-substitution
New contributor
New contributor
edited 1 hour ago
Patrick Mevzek
2,0581721
2,0581721
New contributor
asked 1 hour ago
Yashovan N
111
111
New contributor
New contributor
Can you show an example of âÂÂmore than one timestamp in the same column âÂÂ?
â Jeff Schaller
1 hour ago
1
Re-reading your question, are you perhaps mixing up the terms row and column?
â Jeff Schaller
58 mins ago
add a comment |Â
Can you show an example of âÂÂmore than one timestamp in the same column âÂÂ?
â Jeff Schaller
1 hour ago
1
Re-reading your question, are you perhaps mixing up the terms row and column?
â Jeff Schaller
58 mins ago
Can you show an example of âÂÂmore than one timestamp in the same column âÂÂ?
â Jeff Schaller
1 hour ago
Can you show an example of âÂÂmore than one timestamp in the same column âÂÂ?
â Jeff Schaller
1 hour ago
1
1
Re-reading your question, are you perhaps mixing up the terms row and column?
â Jeff Schaller
58 mins ago
Re-reading your question, are you perhaps mixing up the terms row and column?
â Jeff Schaller
58 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
You can use awk
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | awk 'gsub("[0-9]19", "-")1'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
You can use sed
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | sed -r 's/[0-9]19/-/g'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
You can use awk
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | awk 'gsub("[0-9]19", "-")1'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
You can use sed
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | sed -r 's/[0-9]19/-/g'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
add a comment |Â
up vote
5
down vote
You can use awk
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | awk 'gsub("[0-9]19", "-")1'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
You can use sed
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | sed -r 's/[0-9]19/-/g'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
add a comment |Â
up vote
5
down vote
up vote
5
down vote
You can use awk
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | awk 'gsub("[0-9]19", "-")1'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
You can use sed
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | sed -r 's/[0-9]19/-/g'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
You can use awk
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | awk 'gsub("[0-9]19", "-")1'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
You can use sed
as follows:
echo "+1234|2|12|1|1|1537820114232192380|0 +1234|2|12|1|1|1537820113262689150|0" | sed -r 's/[0-9]19/-/g'
+1234|2|12|1|1|-|0 +1234|2|12|1|1|-|0
edited 38 mins ago
answered 43 mins ago
Goro
6,16552762
6,16552762
add a comment |Â
add a comment |Â
Yashovan N is a new contributor. Be nice, and check out our Code of Conduct.
Yashovan N is a new contributor. Be nice, and check out our Code of Conduct.
Yashovan N is a new contributor. Be nice, and check out our Code of Conduct.
Yashovan N 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%2f472877%2fawk-replace-number-greater-than-17-digits-in-a-column-with%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
Can you show an example of âÂÂmore than one timestamp in the same column âÂÂ?
â Jeff Schaller
1 hour ago
1
Re-reading your question, are you perhaps mixing up the terms row and column?
â Jeff Schaller
58 mins ago