blob: c00d517b08b8624ec3f3e74b505e582fdf538df0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# rev(1)
```sh
# Reverse each line of file(s), character by character.
rev FILE [FILE]
echo -e '123\nabc' | rev
# 321
# cba
```
## Example: remove the last 2 tokens with unknown length
```sh
# If the number of tokens in a line is unkown but we want to remove the last 2
# tokens we can use rev(1).
echo 'aa bb cc dd' | rev | cut -d ' ' -f3- | rev
# aa bb
```
|