# Fix Failed Writing Body While Piping

We can fix `(23) Failed writing body` error while piping `cURL` to some programs like `grep` by using an intermediate such as `tac` which by default reads line from last.

## Example

```bash
curl https://{SOME_URL} | tac | tac | grep {PATTERN}
```

**Note:** Using `tac` as it will first reverse the order, and then reverse it again to get the original body.

***Source:*** [***StackOverFlow***](https://stackoverflow.com/a/28879552)


---

# 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://til.devjugal.com/linux/curl/fix-failed-writing-body-while-piping.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.
