# search command

The search command searches a file for
the existence of one or more strings of characters in any attribute
and optionally creates and saves a list.

## Syntax

```
search file.reference {item.list*} {(options)}
```

## Parameter(s)

| options | a | Outputs in standard assembly listing format. |
| --- | --- | --- |
| d | Outputs entire item on any match. | |
| f | Outputs only the first line containing the string in an item. | |
| e | Allows searching a file for items that do not contain any of the specified strings. | |
| i | Suppresses the item-ID output. Does not affect other output. | |
| j | Outputs only one match per item (overridden by the d option). | |
| l | Prompts for list name and saves the resulting list under the given name. This does not show matches or leave an active list at the end of the process. | |
| n | Outputs the report without pausing at the bottom of each page. | |
| o | Displays item-IDs with matches and does not create a list. | |
| p | Directs output to the system printer, via the spooler (overridden by the l option). | |
| s | Suppresses line number output. | |
| u | Outputs two attributes after, and one line before, the matching line. | |
After invoking the command, the prompt search for: displays on the screen. Any of these responses to this prompt are
valid:

- A string of characters

- Pressing Enter begins the search, after at least one string has been entered.

The item-IDs can be saved in a list when the l option is specified. As the search progresses through the file,
it displays all lines that match the specified search strings by default.

## Example(s)

The following example searches for vb in the master dictionary and saves the list as vb.list
 after completing.

```

 search md (l

 search for:vb

 search for:
 list name: vb.list
 logoff
 sselect
 td
 ...
 [2000] 15 out of 1512 item(s) found.
```

## See also

- [find command](https://d3codex.com/tcl/find-command/)
- [find2 command](https://d3codex.com/tcl/find2-command/)
- [search-system command](https://d3codex.com/tcl/search-system-command/)

---
Source: https://d3codex.com/tcl/search-command/ - part of the D3Codex reference.
