Splunk Search

Need to remove particular character from a field value

pench2k19
Explorer

Hi Ninjas,

I have the following values for host name field .

appra94a0350
appra92a0350
appra84a0201
appra25a0201
appra93a0201
apvra98a0540
appra03*v0337
appra01
v0337
appra02
v0337
appra04
v0337
appra05
v*0337

I need to remove the highlighted v character from the host alues that contains v character in it.

i am using the following query but its not working as expected

|inputlookup alljobs.csv
| eval host=replace(host,"\w{5}\d{2}v\d{4}","\w{5}\d{6}")

Can you please help me here.

Tags (1)
0 Karma

to4kawa
Ultra Champion
| stats count
| eval raw="appra94a0350
appra92a0350
appra84a0201
appra25a0201
appra93a0201
apvra98a0540
appra03*v0337
appra01v0337
appra02v0337
appra04v0337
appra05v*0337"
| makemv delim="
" raw
| mvexpand raw
| eval  eval host=replace(raw,"v\d+","")

Hi, Do you erase the number after "v"?

0 Karma

arjunpkishore5
Motivator

Looks like you just want to remove the v and not everything after v. If yes, this should work

| eval host=replace(host,"v","")
0 Karma
Get Updates on the Splunk Community!

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

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, ...