Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

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.

0
Rate this Question
Comments on this Question
Comment made 1 week ago by Rico 484

Could you show the outputs of the command?

0

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Perhaps you are better off using the following:

set newusername [ findstr $username "/" 1 ]

?

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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

set newusername [string range $username 4 end]
0