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!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...