Forum Discussion

Allwin_179373's avatar
Allwin_179373
Icon for Nimbostratus rankNimbostratus
Feb 07, 2019

Irule trimleft command issue

When i use the Trim Left command in the irule, the intended part and one character from the end of the string is getting trimmed.

 

Below is the configured irule:

 

} elseif { $calledid contains "ABCNET" } then { if { $username contains "host/" } then { log local0. "Fixing username" set newusername [string trimleft $username host/] RADIUS::avp replace User-Name [binary format a* $newusername] binary scan [RADIUS::avp User-Name ] a* newusername log local0. "Fixed username $newusername" } log local0. "Detected ABCNET" set vlanid "00000009" }

 

Let me know if any corrections.

 

3 Replies

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Perhaps you are better off using the following:

    set newusername [ findstr $username "/" 1 ]
    

    ?

  • If you want to remove host at the beginning, you can do:

    set newusername [string range $username 4 end]