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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...