penguinpowernz/implode

A simple command-line tool that joins multiple lines from stdin into a single line with a specified separator.

★ 0Forks 0GoGitHub ↗Compare

README

implode

A simple command-line tool that joins multiple lines from stdin into a single line with a specified separator.

Usage

cat file.txt | implode
#line1 line2 line3
cat file.txt | implode -s ","
#line1,line2,line3
echo -e "line1\nline2\nline3" | implode -s " | "
#line1|line2|line3

Options

  • -s - Separator character/string to join lines (default: space " ")

Examples

Join lines with default space separator:

$ echo -e "hello\nworld"
hello
world

$ echo -e "hello\nworld" | implode
hello world

Join lines with custom separator:

$ echo -e "apple\nbanana\ncherry" | implode -s ","
apple,banana,cherry

Note

The name "implode" is used since join is already a command on most Unix-like systems (used for joining lines of two files on a common field).

Installation

go install github.com/penguinpowernz/implode@latest

Or build from source:

git clone https://github.com/penguinpowernz/implode
cd implode
go build -o implode .

Contributors

penguinpowernz

Issues