uniq

To find repeated matches by `uniq -d`

My data as /tmp/1 9367543 9105616 9108177 8948074 8860323 9170406 9105616 I run and I get nothing cat /tmp/1 | uniq -d This is strange, since uniq -d should -d Only output lines that are repeated in the input. How can you use uniq -d? ...

I can't seem to get the XPATH right for XSD UNIQE Constraint

I've been trying to get the UNIQUE constraint placed on some attributes i have in a fairly basic XSD Schema. I'm using XMLSpy and i'm wanting to put a unique constraint around TEMPLATE.ID for my nodes (ie its important that they remain unique). I've put the below in place and tried the following: Secenario 1 <xs:unique name="uniquevie...

calling uniq and sort in different orders in shell

is there a difference in the order of uniq and sort when calling them in a shell script? i’m talking here about time- and space-wise. grep 'somePattern' | uniq | sort vs. grep 'somePattern' | sort | uniq a quick test on a 140 k lines textfile showed a slight speed improvement (5.5 s vs 5.0 s) for the first method (get uniq values a...

Merge results from uniq -c

I have many files with results of command: uniq -c some_file > some_file.out For example: 1.out: 1 a 2 b 4 c 2.out 2 b 8 c I would like to merge these results, so I get: 1 a 4 b 12 c I thought that sort or uniq could handle it but I don't see any option related to it. Writing some ruby/perl script is one of way to go...

dictionary data insert or select (oracle, java)

Hello, I have an table (in ORADB) containing two columns: VARCHAR unique key and NUMBER unique key generated from an sequence. I need my Java code to constantly (and in parallel) add records to this column whenever a new VARCHAR key it gets, returning the newly generated NUMBER key. Or returns the existing NUMBER key when it gets an ex...

Is there a way to 'uniq' by column ?

Hello, i've a .csv file like this : [email protected],2009-11-27 01:05:47.893000000,xx2.net,127.0.0.1 [email protected],2009-11-27 00:58:29.793000000,xx3.net,255.255.255.0 [email protected],2009-11-27 00:58:29.646465785,2x3.net,256.255.255.0 ... I have to remove similar e-mails ( the entire line ) in the file. The problem is how...

Why does uniq! return nil if there are no duplicates

I'm just starting with Ruby and I personally find the following to be a violation of the "principle of least surprise". And that is, quoting from the documentation, that uniq! "removes duplicate elements from self. Returns nil if no changes are made (that is, no duplicates are found)." Can anybody explain this, which seems completely c...

Best way to generate a unique ID in java

What is the best way to generate a unique ID in java. People generally use String id = System.currentTimeMillis+ someStaticCounter; But this approach would require synchronization in multithreaded applications. I am using try { Thread.sleep(1); //This sleep ensures that two consecutive calls from the same thread does not re...

PHP: why uniqid returned value is only 13 digits long

uniqid() function returns a 13 digits long hexadecimal number. According to the spec in php.net site, the function uses microtime to generate the unique value. But microtime returns numbers in string format as the following one: "0.70352700 12689396875" which are basically the microseconds and the seconds elapsed since 1970. This is a...

Sort & uniq in Linux shell

What is the difference between the following to commands? sort -u FILE sort FILE | uniq Thanks! ...

uniq : only when different by more than 1 character OR case

Hi all :) I got a text file with LOTS of names. I want a list of all the strings(lines) that is either 1) Different in CASE (i.e audi vs AuDI) 2) Different by more than 1 character ie (mygoo VS my-goo) Any ideas ?? ...