This post is more than 5 years old

1 Rookie

 • 

41 Posts

2770

April 29th, 2009 04:00

how to add multiple devices to device group

How do i add a large list of multiple devices to a device group via cli? the devices are non-consecutive.

apologies for this simple question - solutions enabler only describes how to add a single device...

6 Operator

 • 

2.8K Posts

April 30th, 2009 01:00

And the winner is ... :D

1) create a file (list.txt) with devices you want to add to dg
2) create a batch file (add.bat) with the following content
for /f %%dev in (list.txt) do symld -g yourdg add  %%dev

3) run add.bat and enjoy both the long output and the expanded DG ;-)

In case you want less output you can put another line (at the beginning of add.bat)
@echo off
for /f %%dev in (list.txt) do symld -g yourdg add  %%dev

124 Posts

April 29th, 2009 04:00

Hi Bhoran,
Here is what I do :
Get the list of the devices that you need to add to the DG in a file for e.g :

/tmp/test1
1234
1456

Then run an awk command on it with following flags, for e.g : cat /tmp/test1 |awk '{print "symld -g dgname add dev DEV"$1 " " $1}'

you will get an output like :
symld -g dgname add dev DEV1234 1234
symld -g dgname add dev DEV1456 1456

put this output in a file and run it as sh.. you would save some time ;)

6 Operator

 • 

2.8K Posts

April 29th, 2009 05:00

In case you hate awk (or your keyboard doesn't offer all required keys) you can also

cat /tmp/test1 | while read dev
do
symld -g dgname add dev $dev
done

1 Rookie

 • 

41 Posts

April 29th, 2009 06:00

I'm inexperienced at creating & running scripts I'm afraid. There isn't a command within the cli to just call a file listing devs for this?

2 Intern

 • 

155 Posts

April 29th, 2009 13:00

Bhoran that is what Stephano clearly explained above..

you are adding the device names on /tmp/test1,

and looping it with the symld command

this is the easiest way.. put it on a file and run. that will do the job. Please assign points tot he right answer always..

Thanks

124 Posts

April 29th, 2009 21:00

Bhoran,
this is the easiest way out .. no real scrippting in it , just get the list of devices using symdev noport command and put the it in a file ,then do the above steps...

1 Rookie

 • 

41 Posts

April 30th, 2009 01:00

Stefano is right, I run symcli from a windows machine..

batch files are about as techy as I get!

6 Operator

 • 

2.8K Posts

April 30th, 2009 01:00

KD8EWE I simply translated what Bhat already said in his post ;-)
The issue here is that Bhoran doesn't feel comfortable with CLI and symcli ... :D
Probably he is a fellow Windows user...

6 Operator

 • 

2.8K Posts

April 30th, 2009 01:00

You need exactly a batch (.bat) file ... I guess we have to find corresponding commands (since we all talked about unix/linux hosts but you are an unlucky-but-I-guess-happy user of Win$ows machines :D )

Hold your breath and we'll be back ASAP :-)

1 Rookie

 • 

41 Posts

April 30th, 2009 03:00

worked like a charm....many thanks Stefano!

Note: I had to change %%dev to %%a. I was getting the error message "%dev was unexpected at this time.". When in changed to %%a it worked fine.

6 Operator

 • 

2.8K Posts

April 30th, 2009 04:00

I did some tests with %%a .. and it worked .. I assumed it would have worked even with %%dev .. obviously the CMD (dos shell) isn't that smart ;-)
Shame on me (and on the DOS shell) :D
No Events found!

Top