compare within a list
Sathish_21542
Altair Community Member
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!
0
Answers
-
Hi
foreach item $elementlist {
If {[llength [lsearch -all $elementlist $item]]>1} {puts $item}
}
0