Archive

How to get some particular values in top of a column?

pal_sumit1
Path Finder

I want display the result like below table

team name count
abc.com 10
bcd.com 20
cdf.com 30
abc.in 40
bcd.in 50

teams with ".com" present in one list say "COM" and team with ".in" is present in other list say "IN"

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

You can do that by creating a new field by which to sort the results. For example,

<your search> | eval sortField=case(like('team name',"%com"), 1, like('team name', "IN"), 2, 1=1, 99) | sort + sortField | fields - sortField | table "team name" count

The case statement can be expanded to include many more criteria, if desired. If you want to sort alphabetically, try this:

<your search> | rex field='team name' "\.(?<sortField>\w+) | sort + sortField | fields - sortField |  table "team name" count
---
If this reply helps you, an upvote would be appreciated.
0 Karma