From f5178ed1e419cfae7679ae8b4d3130ef48abfbfd Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Tue, 27 Aug 2024 22:31:37 +0200 Subject: cli: add tac, paste --- src/SUMMARY.md | 2 ++ src/cli/README.md | 2 ++ src/cli/paste.md | 22 ++++++++++++++++++++++ src/cli/tac.md | 12 ++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 src/cli/paste.md create mode 100644 src/cli/tac.md (limited to 'src') diff --git a/src/SUMMARY.md b/src/SUMMARY.md index dc2e8bd..0fddc44 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -13,6 +13,8 @@ - [column](./cli/column.md) - [sort](./cli/sort.md) - [tr](./cli/tr.md) + - [tac](./cli/tac.md) + - [paste](./cli/paste.md) - [Tools](./tools/README.md) - [tmux](./tools/tmux.md) diff --git a/src/cli/README.md b/src/cli/README.md index 2625899..5eac7cb 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -5,3 +5,5 @@ - [column](./column.md) - [sort](./sort.md) - [tr](./tr.md) +- [tac](./tac.md) +- [paste](./paste.md) diff --git a/src/cli/paste.md b/src/cli/paste.md new file mode 100644 index 0000000..114002c --- /dev/null +++ b/src/cli/paste.md @@ -0,0 +1,22 @@ +# paste(1) + +``` +# Concatenate input files linewise and join them by a TAB char. + +paste FILE [FILE] + -d CHAR delimiter to join each line +``` + +# Examples + +```sh +# Read two files. +paste <(echo -e 'a1\na2') <(echo -e 'b1\nb2') +a1 b1 +a2 b2 + +# Can read from stdin. +echo -e 'a1 a2\nb1 b2\nc1 c2\nd1 d2' | paste - - +# a1 a2 b1 b2 +# c1 c2 d1 d2 +``` diff --git a/src/cli/tac.md b/src/cli/tac.md new file mode 100644 index 0000000..eba42ba --- /dev/null +++ b/src/cli/tac.md @@ -0,0 +1,12 @@ +# tac(1) + +```sh +# Reverse output lines of file(s) and concatenate (reverse of cat). +tac FILE [FILE] + +echo -e 'aa\nbb\ncc\ndd' | tac +# dd +# cc +# bb +# aa +``` -- cgit v1.2.3