eolas/zk/Truncate_stdout_with_cut.md

24 lines
318 B
Markdown
Raw Normal View History

2025-11-06 18:43:00 +00:00
---
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
```