Remove row of first duplicated column 1 from csv

The name of the pictureThe name of the pictureThe name of the pictureClash 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.










share|improve this question









New contributor




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



















  • Better use a tool designed to process csv, not the shell directly.
    – Isaac
    2 mins ago














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.










share|improve this question









New contributor




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



















  • Better use a tool designed to process csv, not the shell directly.
    – Isaac
    2 mins ago












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.










share|improve this question









New contributor




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











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






share|improve this question









New contributor




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











share|improve this question









New contributor




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









share|improve this question




share|improve this question








edited 4 mins ago









Isaac

8,92211342




8,92211342






New contributor




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









asked 25 mins ago









Ian

1




1




New contributor




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





New contributor





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






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











  • 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




Better use a tool designed to process csv, not the shell directly.
– Isaac
2 mins ago










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Try the below command,



awk -F',' '!seen[$1]++' file.csv 





share|improve this answer




















  • 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










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: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Ian 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%2f479304%2fremove-row-of-first-duplicated-column-1-from-csv%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













Try the below command,



awk -F',' '!seen[$1]++' file.csv 





share|improve this answer




















  • 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














up vote
0
down vote













Try the below command,



awk -F',' '!seen[$1]++' file.csv 





share|improve this answer




















  • 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












up vote
0
down vote










up vote
0
down vote









Try the below command,



awk -F',' '!seen[$1]++' file.csv 





share|improve this answer












Try the below command,



awk -F',' '!seen[$1]++' file.csv 






share|improve this answer












share|improve this answer



share|improve this answer










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
















  • 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










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









 

draft saved


draft discarded


















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.













 


draft saved


draft discarded














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













































































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?