Forum Discussion
Dharshana_11419
Nimbostratus
Nov 20, 2017findstr - sub string of last occurrence of a character to the end of the string
Hi,
Can someone please help me how to find the last occurrence of a character and get a sub string from thereafter to the end of the string using findstr?
i.e from XXX-GHDF-12XD45 i need to match 12X...
Samir_Jha_52506
Noctilucent
Nov 20, 2017You can use
getfield function also to match the column if the position is known.
Example: XXX-GHDF-12XD45
set eidval {XXX-GHDF-12XD45}
set val [getfield $eidval "-" 3]
https://devcentral.f5.com/wiki/irules.findstr.ashx
OR
set spr "XXXA-GHDF-12XD45"
set sub_spr [string range $spr [string last "-" $spr]+1 end
- Stanislas_Piro2Nov 20, 2017
Cumulonimbus
I also watched
command but didn't find how to say the last field.getfield - Samir_Jha_52506Nov 20, 2017
Noctilucent
You are right. I am just capturing position value with getfield function.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
