Splunk Search

how can i use like and not like in the same query?

ashidhingra
Path Finder

| where like(RouteCode, "50%") AND !like(RouteCode, "503%")

I am trying to show Routecode 501,2, -- anyother not 503.

Labels (5)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The negation operator is NOT.

 

| where (like(RouteCode, "50%") AND NOT like(RouteCode, "503%"))

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The negation operator is NOT.

 

| where (like(RouteCode, "50%") AND NOT like(RouteCode, "503%"))

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...