2015-12-28 22:01:39 +01:00
|
|
|
# tac
|
|
|
|
|
2022-05-14 04:29:53 +10:00
|
|
|
> Display and concatenate files with lines in reversed order.
|
|
|
|
> See also: `cat`.
|
2025-01-18 18:45:33 +05:30
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/tac-invocation.html>.
|
2015-12-28 22:01:39 +01:00
|
|
|
|
2022-05-14 04:29:53 +10:00
|
|
|
- Concatenate specific files in reversed order:
|
2015-12-28 22:01:39 +01:00
|
|
|
|
2022-05-14 04:29:53 +10:00
|
|
|
`tac {{path/to/file1 path/to/file2 ...}}`
|
2015-12-28 22:01:39 +01:00
|
|
|
|
2022-05-14 04:29:53 +10:00
|
|
|
- Display `stdin` in reversed order:
|
2020-02-08 20:18:47 +05:30
|
|
|
|
2022-05-14 04:29:53 +10:00
|
|
|
`{{cat path/to/file}} | tac`
|
2020-02-08 20:18:47 +05:30
|
|
|
|
2025-03-22 08:37:12 +02:00
|
|
|
- Use a specific separator:
|
2015-12-28 22:01:39 +01:00
|
|
|
|
2025-03-22 08:37:12 +02:00
|
|
|
`tac {{[-s|--separator]}} {{separator}} {{path/to/file1 path/to/file2 ...}}`
|
2022-05-14 04:29:53 +10:00
|
|
|
|
2025-03-22 08:37:12 +02:00
|
|
|
- Use a specific regex as a separator:
|
2022-05-14 04:29:53 +10:00
|
|
|
|
2025-03-22 08:37:12 +02:00
|
|
|
`tac {{[-r|--regex]}} {{[-s|--separator]}} {{separator}} {{path/to/file1 path/to/file2 ...}}`
|
2022-05-14 04:29:53 +10:00
|
|
|
|
2025-03-22 08:37:12 +02:00
|
|
|
- Use a separator before each file:
|
2022-05-14 04:29:53 +10:00
|
|
|
|
2025-03-22 08:37:12 +02:00
|
|
|
`tac {{[-b|--before]}} {{path/to/file1 path/to/file2 ...}}`
|