All Apps and Add-ons

Rtrim a period

kragel
Path Finder

I'm trying to use rtrim but when it sees a period it does not remove just the period. It removes extra characters too. I've tried escaping it but I get the same result. I know I'm doing something wrong but I can't figure out how to fix it. Can anyone tell me if there's a way to have rtrim see the period as a period and just remove it? Or any other suggestions? Thanks.

$to$=<someaddress@somedomain.com.procmail>

eval new_to=ltrim(rtrim(to,".procmail>"),"<")

The result is:
$new_to$=someaddress@somed

If I try the following I get the same result

eval new_to=ltrim(rtrim(to,"\.procmail>"),"<")

I'm trying to get

someaddress@somedomain.com

0 Karma
1 Solution

somesoni2
Revered Legend

Try this

...|  eval new_to=replace(replace(to,".procmail>",""),"<","")

OR (overwrite same field)

...| rex field=to mode=sed "s/(\<)(\S+)(\.procmail\>)/\2/g"

View solution in original post

somesoni2
Revered Legend

Try this

...|  eval new_to=replace(replace(to,".procmail>",""),"<","")

OR (overwrite same field)

...| rex field=to mode=sed "s/(\<)(\S+)(\.procmail\>)/\2/g"

kragel
Path Finder

Replace worked. Thank you!

0 Karma
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...