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!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Deprecation of Splunk Observability Kubernetes “Classic Navigator” UI starting ...

Access to Splunk Observability Kubernetes “Classic Navigator” UI will no longer be available starting January ...