Splunk Search

How to modify the results in required format?

pavanae
Builder

I have a lookup query as follows

| inputlookup hosts.csv | rename hostname as my_hostname | table my_hostname

the results are follows

abcd
abcf.sjs.com
GHK
ghli.sjd.com

How can I modify my query to display the results in the below format for the above results

abcd
abcf
GHK
ghli

I want to remove the letters after dot in the results and just want to display the words like above

0 Karma
1 Solution

cmerriman
Super Champion

try adding this to the end:

|rex mode=sed field=my_hostname "s/\..*//g"

View solution in original post

cmerriman
Super Champion

try adding this to the end:

|rex mode=sed field=my_hostname "s/\..*//g"
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...