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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...