Splunk Search

How to combine two fields, but add quotations marks around one of the fields prior to combining?

minkyuk
Explorer

Hello folks,

I am trying to combine two fields by string; however, I need to put quotation marks around one of the fields prior to combining.

A            B
coc19        /afs/po101        
coc20        D:

I want the output to look like:

COMBINED STRING
coc19 "/afs/po101"
coc20 "D:"

What should I do to eval combstr = A +" "+B to add quotation marks?

I would appreciate your input

Thanks

Tags (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This works for me:

eval combstr=A+" "+"\""+B+"\""
---
If this reply helps you, Karma would be appreciated.

View solution in original post

chimell
Motivator

Hi
Try this search code

 ......|eval COMBINED_STRING=A." "."\"".B."\""
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This works for me:

eval combstr=A+" "+"\""+B+"\""
---
If this reply helps you, Karma would be appreciated.

minkyuk
Explorer

Thank you sir

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...