Skip to content
Advertisement

How to delete duplicated rows based in a column value?

Given the following table

JavaScript

Using a bash shell script based in Linux, I’d like to delete all the rows based on the value of column 1 (The one with the long number). Having into consideration that this number is a variable number

I’ve tried with

awk '{a[$3]++}!(a[$3]-1)' file

JavaScript

But I am not getting the result which would be something like this, making a comparison between all the values of the first column, delete all the duplicates and show it

JavaScript

Advertisement

Answer

you didn’t give an expected output, does this work for you?

JavaScript

with your data, the output is:

JavaScript

and this line prints only unique column1 line:

JavaScript

output:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement