23 lines
318 B
Markdown
23 lines
318 B
Markdown
---
|
|
tags:
|
|
- Linux
|
|
- procedural
|
|
---
|
|
|
|
# Truncate stdout with `cut`
|
|
|
|
Pass in `-c` to truncate characters or `-b` to truncate bytes.
|
|
|
|
Return the first three characters of "Thomas":
|
|
|
|
```sh
|
|
echo 'thomas' | cut -c -3
|
|
# tho
|
|
```
|
|
|
|
Return "Thomas" minus the first three chracters:
|
|
|
|
```sh
|
|
echo 'thomas' | cut -c 3-
|
|
# omas
|
|
```
|