# Omit

Works like `pick`, but instead you specify the keys/indices that you *don't* want included.

## Omit keys from map

Note that non existent keys are skipped.

Given a sample.yml file of:

```yaml
myMap:
  cat: meow
  dog: bark
  thing: hamster
  hamster: squeak
```

then

```bash
yq '.myMap |= omit(["hamster", "cat", "goat"])' sample.yml
```

will output

```yaml
myMap:
  dog: bark
  thing: hamster
```

## Omit indices from array

Note that non existent indices are skipped.

Given a sample.yml file of:

```yaml
- cat
- leopard
- lion
```

then

```bash
yq 'omit([2, 0, 734, -5])' sample.yml
```

will output

```yaml
- leopard
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mikefarah.gitbook.io/yq/operators/omit.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
