## Grep File `$ llamacloud-prod beta:retrieval grep` **post** `/api/v1/retrieval/files/grep` Grep within a file's parsed content using a regex pattern. ### Parameters - `--file-id: string` Body param: ID of the file to grep. - `--index-id: string` Body param: ID of the index the file belongs to. - `--pattern: string` Body param: Regex pattern to search for. - `--organization-id: optional string` Query param - `--project-id: optional string` Query param - `--context-chars: optional number` Body param: Number of characters of context to include before and after the matched pattern in the content field of the response - `--page-size: optional number` Body param: The maximum number of items to return. The service may return fewer than this value. If unspecified, a default page size will be used. The maximum value is typically 1000; values above this will be coerced to the maximum. - `--page-token: optional string` Body param: A page token, received from a previous list call. Provide this to retrieve the subsequent page. ### Returns - `FileGrepResult: object { items, next_page_token, total_size }` Paginated grep results for a file. - `items: array of object { content, end_char, start_char }` The list of items. - `content: string` Matched text content. - `end_char: number` End character offset of the match. - `start_char: number` Start character offset of the match. - `next_page_token: optional string` A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages. - `total_size: optional number` The total number of items available. This is only populated when specifically requested. The value may be an estimate and can be used for display purposes only. ### Example ```cli llamacloud-prod beta:retrieval grep \ --api-key 'My API Key' \ --file-id file_id \ --index-id idx-abc123 \ --pattern 'revenue|profit' ``` #### Response ```json { "items": [ { "content": "content", "end_char": 0, "start_char": 0 } ], "next_page_token": "next_page_token", "total_size": 0 } ```