Announcement Banner

choefing

updated

13 years ago

C

choefing

1 Rookie

•

49 Posts

0

1355

August 27th, 2013 17:00

ASL - string replacements

SAM / IP 7.x

Hi,

I receive traps from several devices whichs names follow slightly changing pattern.

In trap manager an asl script is included for the particular OID where I wanted to cut the names.

Actually I do it with substring and cut after 13th character what only meets a part of the devices sending traps.

The name convention patterns would be best explained with:

AABB1234567890_XX_YY

AABB1234567890_XXX_YY

AACC12345_XX_YY

AACC12345_XXX_YY

What they have in common is that I need the part before first "_".

As you can see I can't cut everything after n-th character nor could i count backwards, so substring wouldnt help me.

Is there a function I can use to match for "_" and cut this and everything after ?

Workaround would be to check for AABB or AACC and then cut after n-th character but I prefer a 1-liner.

Thanks

Christian