# man > erb(1)

---
type: CommandReference
command: erb
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `erb [file ...]` — Process ERB template files
- `erb -T - file` — Remove EOL after `%>` (trim mode `-`)
- `erb --version` — Print version
- `erb --help` — Print help summary
- `erb -E utf-8 file` — Set external encoding to UTF-8
- `erb -d file` — Enable debug mode

## Name

**erb** — Ruby Templating

## Synopsis

**erb** [**--version**] [**-UPdnvx**] [**-E** _ext_[:_int_]] [**-S** _level_] [**-T** _mode_] [**-r** _library_] [**--**] [file ...]

## Options

- `--version` — Print the version of **erb**
- `-E, --encoding external[:internal]` — Specify default external and internal encoding. Internal encoding can be omitted (defaults to nil)
- `-T mode` — Set trim mode:
  - `0` — EOL remains after embedded Ruby script is evaluated
  - `1` — EOL removed if line ends with `%>`
  - `2` — EOL removed if line starts with `<%` and ends with `%>`
  - `-` — EOL removed if line ends with `-%>`; leading whitespace removed if starts with `<%-`
- `-U` — Set internal encoding to UTF-8
- `-d, --debug` — Turn on debug mode (`$DEBUG = true`)
- `-h, --help` — Print a summary of options

## Examples

Script `example.erb`:

text
<?xml version="1.0" ?>
<% require 'prime' -%>
<erb-example>
  <calc><%= 1+1 %></calc>
  <var><%= __FILE__ %></var>
  <library><%= Prime.each(10).to_a.join(", ") %></library>
</erb-example>
Command:

shell
erb -T - example.erb
Output:

text
<?xml version="1.0" ?>
<erb-example>
  <calc>2</calc>
  <var>example.erb</var>
  <library>2, 3, 5, 7</library>
</erb-example>
## See Also

[ruby(1)](http://localhost/phpMan.php/man/ruby/1/markdown)

[ri(1)](http://localhost/phpMan.php/man/ri/1/markdown) — documentation for the ERB class