Turn all commans into newlines:
cat <FILE> | sed 's/,/\n/g'
Remove all blank lines from a file (I alias this as
cat <FILE> | sed '/^$/d'
Trim multiple adjacent whitespaces and whitespace at beginning and end of line
(I alias this as my
cat <FILE> | sed 's/^\s*//' | sed 's/\s\s*/ /g' | sed 's/\s*$//'
Turn all newlines into spaces:
sed ':a;N;$!ba;s/\n/ /g'
This will read the whole file in a loop, then replaces the newline(s) with a
space. It creates a register via
:a and appends the current and next line to
the register via
N. If it is before the last line, it branches to the created
$! means not to do it on the last line as there should be one
final newline). Finally, the substitution replaces every newline in the
register (now the whole file) with a space.