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'