system
October 25, 2012, 5:57pm
1
(imported topic written by SystemAdmin)
Hi all,
I’m trying to find out how to identify what computers on the system have duplicate names.
e.g. if two computers exist on the system called “abc-123”
(name of it, number of it) of bes computers
would list:
abc-123, 1 ... abc-123, 1
rather than what I would like to see, which is:
abc-123, 2
I can get that result by explicitly naming the computer, i.e.
number of bes computers whose( name of it =
"abc-123" ) Result: 2
But can anyone tell me how I can do this without having to explicitly name computers?
system
October 25, 2012, 6:19pm
2
(imported comment written by SystemAdmin)
I was hoping that I could something like this:
(set of ALL computer names) - (set of unique computer names)
and be left with just the duplicates, but it looks like that approach doesn’t work:
elements of ( set of ( names of bes computers as lowercase ) - set of ( unique values of ( names of bes computers ) as lowercase ) )
I expect the “-” removes duplicates as well, so the above just returns nothing
system
October 25, 2012, 7:50pm
3
(imported comment written by SystemAdmin)
Might it be possible to use the
multiplicity of
in some way to get a result here?
system
October 25, 2012, 8:13pm
4
(imported comment written by SystemAdmin)
Okay… almost there I think now.
I can get what I was looking for by using this expression:
( it, multiplicity of it ) of unique values of names of bes computers
this gives
... abc-123, 2 ...
However, this includes ALL computers, even the ones that have only a single instance.
So I need to add a:
whose( multiplicity of it > 1 )
in here, but that doesn’t seem to be as straightforward as normal…
system
October 25, 2012, 8:19pm
5
(imported comment written by SystemAdmin)
Bingo:
( it, multiplicity of it ) of unique values whose ( multiplicity of it > 1 ) of names of bes computers
This expression displays the name, and number of instances of that name, on the system where the number of instance is greater than 1.
Phew!
system
October 25, 2012, 8:25pm
6
(imported comment written by PeterLoer)
I was just going to reply with:
(
(
it, multiplicity of it
)
of unique values of names of bes computers
)
whose ( item 1 of it > 1 )
Yours is more readable, though.
cheers,
peter
system
October 25, 2012, 8:34pm
7
(imported comment written by SystemAdmin)
Thanks Peter - I had actually tried it your way first, but I forgot to include an extra set of parentheses before the ‘whose’, so it wouldn’t work.
I.e. instead of what you had, I had this:
( it, multiplicity of it ) of unique values of names of bes computers whose ( item 1 of it > 1 )
which results in:
Error: The tuple index 1 is out of range.
so I’ve learned something! Cheers!
1 Like
system
November 16, 2012, 7:06pm
8
(imported comment written by SystemAdmin)
This solution does not include “singleton” instances that differ only by the case of the letters.
e.g.
“abc-123”
“ABC-123”
“AbC-123”
The multiplicity expression does not allow for these, it appears to treat each one individually, whereas targeting with any one of these names would target all 3.
system
November 17, 2012, 12:56am
9
(imported comment written by PeterLoer)
If you just case all your inputs to lowercase I think you should get the results you’re looking for:
unique values of (it as lowercase) of names of bes computers
cheers,
peter
system
November 19, 2012, 2:02pm
10
(imported comment written by SystemAdmin)
That’s fantastic - thanks a lot Peter!
Exactly what I needed!
Cheers,
P.