i know this isn't the perfect forum for this question, but i thought i'd see if someone can help.
i'm working with a tab delimited file that looks something like:
domain1.com | unique value | unique value
domain2.com | unique value | unique value
domain2.com | unique value | unique value **field 1 !unique
domain3.com | unique value | unique value
domain4.com | unique value | unique value
domain5.com | unique value | unique value
domain6.com | unique value | unique value
i need to remove lines where the first field is not unique. i haven't found a way to use sort or uniq because each of the lines are unique since there are values in the line that are unique.
anyone know how to sort -u OR uniq while ignoring all but the first field?
i'm pulling this file in thru PHP and processing it for html output. so if there's a way to accomplish the same thing in php while reading or processing the file, that would be great too. in the case of repeats, the first occurance is the one i want to keep so maybe there's a way to skip a row if $field1 is the same as $field1 was on the last loop? hopefully this makes enought sense.
thanks