Remove row of first duplicated column 1 from csv
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I need some help removing first repeated line (for field 1) from a csv file.
I have a large csv file with a structure similar to this:
334050049049426,2018-11-06T20:21:56.591Z,xxx,gdl-qns28-1540279057144
334050049049426,2018-11-06T21:32:47.431Z,xxx,gdl-qns19-1540278993723
334090015032064,2018-11-06T22:22:31.247Z,xxx,gdl-qns15-1540279009813
334090015032064,2018-11-07T01:44:11.442Z,xxx,gdl-qns25-1540279437614
334090015032064,2018-11-07T03:57:18.911Z,xxx,gdl-qns28-1540279710160
334050069888299,2018-11-07T03:32:12.899Z,xxx,gdl-qns29-1540279367769
334050069888299,2018-11-07T03:58:15.475Z,xxx,mgc-qns20-1540281468455
I need to be able to remove the first line found of duplicated values from the first column so for example line # 1,3 and 6 needs to be remove.
any help is greatly appreciated.
shell-script shell
New contributor
add a comment |Â
up vote
0
down vote
favorite
I need some help removing first repeated line (for field 1) from a csv file.
I have a large csv file with a structure similar to this:
334050049049426,2018-11-06T20:21:56.591Z,xxx,gdl-qns28-1540279057144
334050049049426,2018-11-06T21:32:47.431Z,xxx,gdl-qns19-1540278993723
334090015032064,2018-11-06T22:22:31.247Z,xxx,gdl-qns15-1540279009813
334090015032064,2018-11-07T01:44:11.442Z,xxx,gdl-qns25-1540279437614
334090015032064,2018-11-07T03:57:18.911Z,xxx,gdl-qns28-1540279710160
334050069888299,2018-11-07T03:32:12.899Z,xxx,gdl-qns29-1540279367769
334050069888299,2018-11-07T03:58:15.475Z,xxx,mgc-qns20-1540281468455
I need to be able to remove the first line found of duplicated values from the first column so for example line # 1,3 and 6 needs to be remove.
any help is greatly appreciated.
shell-script shell
New contributor
Better use a tool designed to process csv, not the shell directly.
â Isaac
2 mins ago
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I need some help removing first repeated line (for field 1) from a csv file.
I have a large csv file with a structure similar to this:
334050049049426,2018-11-06T20:21:56.591Z,xxx,gdl-qns28-1540279057144
334050049049426,2018-11-06T21:32:47.431Z,xxx,gdl-qns19-1540278993723
334090015032064,2018-11-06T22:22:31.247Z,xxx,gdl-qns15-1540279009813
334090015032064,2018-11-07T01:44:11.442Z,xxx,gdl-qns25-1540279437614
334090015032064,2018-11-07T03:57:18.911Z,xxx,gdl-qns28-1540279710160
334050069888299,2018-11-07T03:32:12.899Z,xxx,gdl-qns29-1540279367769
334050069888299,2018-11-07T03:58:15.475Z,xxx,mgc-qns20-1540281468455
I need to be able to remove the first line found of duplicated values from the first column so for example line # 1,3 and 6 needs to be remove.
any help is greatly appreciated.
shell-script shell
New contributor
I need some help removing first repeated line (for field 1) from a csv file.
I have a large csv file with a structure similar to this:
334050049049426,2018-11-06T20:21:56.591Z,xxx,gdl-qns28-1540279057144
334050049049426,2018-11-06T21:32:47.431Z,xxx,gdl-qns19-1540278993723
334090015032064,2018-11-06T22:22:31.247Z,xxx,gdl-qns15-1540279009813
334090015032064,2018-11-07T01:44:11.442Z,xxx,gdl-qns25-1540279437614
334090015032064,2018-11-07T03:57:18.911Z,xxx,gdl-qns28-1540279710160
334050069888299,2018-11-07T03:32:12.899Z,xxx,gdl-qns29-1540279367769
334050069888299,2018-11-07T03:58:15.475Z,xxx,mgc-qns20-1540281468455
I need to be able to remove the first line found of duplicated values from the first column so for example line # 1,3 and 6 needs to be remove.
any help is greatly appreciated.
shell-script shell
shell-script shell
New contributor
New contributor
edited 4 mins ago
Isaac
8,92211342
8,92211342
New contributor
asked 25 mins ago
Ian
1
1
New contributor
New contributor
Better use a tool designed to process csv, not the shell directly.
â Isaac
2 mins ago
add a comment |Â
Better use a tool designed to process csv, not the shell directly.
â Isaac
2 mins ago
Better use a tool designed to process csv, not the shell directly.
â Isaac
2 mins ago
Better use a tool designed to process csv, not the shell directly.
â Isaac
2 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try the below command,
awk -F',' '!seen[$1]++' file.csv
This does the opposite of what was asked. That is: it will print the first line and remove all following repeats.
â Isaac
2 mins ago
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
Try the below command,
awk -F',' '!seen[$1]++' file.csv
This does the opposite of what was asked. That is: it will print the first line and remove all following repeats.
â Isaac
2 mins ago
add a comment |Â
up vote
0
down vote
Try the below command,
awk -F',' '!seen[$1]++' file.csv
This does the opposite of what was asked. That is: it will print the first line and remove all following repeats.
â Isaac
2 mins ago
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Try the below command,
awk -F',' '!seen[$1]++' file.csv
Try the below command,
awk -F',' '!seen[$1]++' file.csv
answered 19 mins ago
EBIN GLADSON
4156
4156
This does the opposite of what was asked. That is: it will print the first line and remove all following repeats.
â Isaac
2 mins ago
add a comment |Â
This does the opposite of what was asked. That is: it will print the first line and remove all following repeats.
â Isaac
2 mins ago
This does the opposite of what was asked. That is: it will print the first line and remove all following repeats.
â Isaac
2 mins ago
This does the opposite of what was asked. That is: it will print the first line and remove all following repeats.
â Isaac
2 mins ago
add a comment |Â
Ian is a new contributor. Be nice, and check out our Code of Conduct.
Ian is a new contributor. Be nice, and check out our Code of Conduct.
Ian is a new contributor. Be nice, and check out our Code of Conduct.
Ian 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%2f479304%2fremove-row-of-first-duplicated-column-1-from-csv%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
Better use a tool designed to process csv, not the shell directly.
â Isaac
2 mins ago