![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Sometimes you want to paste the output of a
...you get:
Very useful sometimes :D
grep
command into IRC or IM, and don't want each match on a separate line. Fortunately, it's easy to convert it to a comma-separated list instead - simply pipe the output through xargs echo | sed 's/ /, /g'
. So, for example, instead of:Sophie@Sophie-Laptop:~/primtionary$ grep cuddle american-english-insane
cuddle
cuddleable
cuddled
cuddler
cuddlers
cuddles
cuddlesome
scuddle
scuddled
scuddles
upscuddle
...you get:
Sophie@Sophie-Laptop:~/primtionary$ grep cuddle american-english-insane | xargs echo | sed 's/ /, /g'
cuddle, cuddleable, cuddled, cuddler, cuddlers, cuddles, cuddlesome, scuddle, scuddled, scuddles, upscuddle
Very useful sometimes :D