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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...