Splunk Search

Remove duplicate columns - column which have single unique value

bhavesh0124
Explorer

Hi, 

I want to get rid of columns which have single unique value. There could be multiple columns showing this behavior. 

TestValue1Value2Value3Value4
Test12ba7
Test21ca7

 

I want to get rid of columns "Value3" and "Value4" since they have only one unique value across.

 

@gcusello @ITWhisperer @scelikok @PickleRick 

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Depending on the size of your data set, you could try something like this

| appendpipe
    [| stats values(*) as *
    | eval Test="ALL"]
| transpose 0 column_name=name header_field=Test
| where mvcount(ALL) > 1
| fields - ALL
| transpose 0 column_name=Test header_field=name

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Depending on the size of your data set, you could try something like this

| appendpipe
    [| stats values(*) as *
    | eval Test="ALL"]
| transpose 0 column_name=name header_field=Test
| where mvcount(ALL) > 1
| fields - ALL
| transpose 0 column_name=Test header_field=name

bhavesh0124
Explorer

Works perfectly, thanks

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @bhavesh0124,

sorry bu it isn't possible: Splunk isn't Excel in which you can collapse two cells in one.

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...

Industry Solutions for Supply Chain and OT, Amazon Use Cases, Plus More New Articles ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Enterprise Security Content Update (ESCU) | New Releases

In November, the Splunk Threat Research Team had one release of new security content via the Enterprise ...