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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...