arcade16
arcade16

Reputation: 1535

How to take column of integers and assign string value based on range

I am a splunk novice and looking to take a column of int values and have them display as a string based on the range they fall in.

I.e.
Ints from 1-100 should display: Low 
Ints from 101-200 should display: Medium 
Ints from 201-300 should display: High

I believe I can use an eval statement to accomplish this, but am not sure where to go from there. How would I achieve this?

Upvotes: 1

Views: 108

Answers (1)

Kiley
Kiley

Reputation: 419

The easiest way would probably be to make it into a case statement:

| eval "new_column" = case (
    variable_evaluating >= 1 AND variable_evaluating <= 100, "Low",
    variable_evaluating >= 101 AND variable_evaluating <= 200, "Medium", 
    variable_evaluating >= 201, "High")

Upvotes: 1

Related Questions