# Keystroke-savers

## Short format specifiers, including --c2p

In our examples so far, we've often made use of `mlr --icsv --opprint` or `mlr --icsv --ojson`. These are such frequently occurring patterns that they have short options like `--c2p` and `--c2j`:

GENMD-RUN-COMMAND
mlr --c2p head -n 2 example.csv
GENMD-EOF

GENMD-RUN-COMMAND
mlr --c2j head -n 2 example.csv
GENMD-EOF

You can get the full list [here](file-formats.md#data-conversion-keystroke-savers).

## File names up front, including --from

Already, we saw that you can put the filename first using `--from`. When you're interacting with your data at the command line, this makes it easier to up-arrow and append to the previous command:

GENMD-RUN-COMMAND
mlr --c2p --from example.csv sort -nr index then head -n 3
GENMD-EOF

GENMD-RUN-COMMAND
mlr --c2p --from example.csv sort -nr index then head -n 3 then cut -f shape,quantity
GENMD-EOF

If there's more than one input file, you can use `--mfrom`, then however many file names, then `--` to indicate the end of your input-file-name list:

GENMD-SHOW-COMMAND
mlr --c2p --mfrom data/*.csv -- sort -n index
GENMD-EOF

Alternatively, you may place filenames within another file, one per line:

GENMD-SHOW-COMMAND
cat data/filenames.txt
GENMD-EOF

GENMD-SHOW-COMMAND
mlr --c2p --files data/filenames.txt cat
GENMD-EOF

## Shortest flags for CSV, TSV, and JSON

The following have even shorter versions:

* `-c` is the same as `--csv`
* `-t` is the same as `--tsv`
* `-j` is the same as `--json`

I don't use these within these documents, since I want the docs to be self-explanatory on every page, and
I think `mlr --csv ...` explains itself better than `mlr -c ...`. Nonetheless, they're always there for you to use.

## .mlrrc file

If you want the default file format for Miller to be CSV, you can put `--csv` on a line by itself in your `~/.mlrrc` file. Then, instead of `mlr --csv cat example.csv` you can just do `mlr cat example.csv`. This is just a personal default, though, so `mlr --opprint cat example.csv` will use default CSV format for input, and PPRINT (tabular) for output.

You can read more about this at the [Customization](customization.md) page.

## Scripts and mlr -s

Suppose you are often doing something like

GENMD-CARDIFY
mlr --csv \
filter ‘$quantity > 100’ then \
count-distinct -f category then \
fraction -f count \
filename-which-varies.csv
GENMD-EOF

Typing this out can get a bit old if the only thing that changes for you is the filename.

See [Scripting with Miller](scripting.md) for some keystroke-saving options.
