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 the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...