Splunk Search

How to change values in a column based on a value in a different column in the same row?

mprreddy51
Explorer

Hi,

I have a requirement:

My table data shows like this:

ACCNO    STATUS    TYPE    CODE
123       A        GOL     TECH
456       A        SIL     TECH
199       A        GRR     TECH
789       A        GOL     TECH
143       A        0       TECH
543       A        0       TECH 

Expected output:

ACCNO    STATUS    TYPE   CODE
123       A        GOL    TECH
456       A        SIL    TECH
199       A        GRR    TECH
789       A        GOL    TECH
143       A        0      0
543       A        0      0

I want to display the value as " 0" in CODE wherever TYPE value is 0.

Thanks In advance.

-PR

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try this

... | eval CODE=if(TYPE=0,0,CODE) | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...