#concat #stream #sed #cut #grep #data #line

app concat-util

Simple utility for concatenating rows in a stream

2 unstable releases

0.2.0 Sep 17, 2019
0.1.0 Sep 17, 2019

#12 in #cut

MIT license

5KB
75 lines

Concat

A simple utility for concatenating lines from stdin.

Motivation

I often find myself in the situation where I need to scrape data from logs, use combinations of grep, cut, and sed to extract values, then turn those values into various SQL queries.

The last step is always the most annoying, so I decided to spend a few minutes to make this tool.

Examples

Example file

animals.txt
Lassie
Flipper
Willy

Raw

Put everything together with no delimiter or quote marks:

$ cat animals.txt | concat
LassieFlipperWilly

Let's add quote marks

$ cat animals.txt | concat -q "'"
'Lassie''Flipper''Willy'

Let's add a delimiter

$ cat animals.txt | concat -d ", "
Lassie, Flipper, Willy

Let's do both

$ cat animals.txt | concat -q "'" -d ", "
'Lassie', 'Flipper', 'Willy'

Dependencies

~2.5MB
~48K SLoC