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!

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...