compare within a list
Hi,
I have a list of elements with ids as:
set elementlist { {100 101} {1000 1001} {101 100} {1001 1000} }
I need to check for duplicate ids within the list. whichever item is existing twice should be written as output.
expected output:
{100 101} {1000 1001}
or
{101 100} {1001 1000}
Can anyone help me with this?
Thanks in advance!
Find more posts tagged with
Sort by:
1 - 1 of
11
Hi
foreach item $elementlist {
If {[llength [lsearch -all $elementlist $item]]>1} {puts $item}
}