Forum Discussion

deepu8843_18569's avatar
deepu8843_18569
Icon for Nimbostratus rankNimbostratus
Sep 26, 2018

Modification of data group in CLI mode

Suppose I have a datagroup say name as xyz which contains only strings. But there are around 150 strings added in the data group. Now I want to modify the data group where I want to add another 150 new strings. If I do manually it will take lots of time. How to do it in VI editor or any other alternative method via CLI mode?

 

  • You could use TMSH:

    modify ltm data-group internal testdg records add { test-key { data test-value } }
    

    You could also simply replace the entire data group.

  • If you want to update from a file just keys without values try this...

     tmsh list ltm data-group internal dg1
    ltm data-group internal dg1 {
        records {
            a { }
            b { }
        }
        type string
    }
    
     more updates.txt 
    c
    d
    e
    f
    
     for a in `cat updates.txt`; do tmsh modify ltm data-group internal dg1 records add { $a } ; done
    
     tmsh list ltm data-group internal dg1
    ltm data-group internal dg1 {
        records {
            a { }
            b { }
            c { }
            d { }
            e { }
            f { }
        }
        type string
    }