I'm looking for the opposite or the converse of GNU fold — a command line program that would join word-wrapped text into a single line per paragraph. In other words, something that would take input containing adjacent lines of text like this:
now is
the time for
all good men
to come to the
aid of their
country
where adjacent paragraphs were separated with blank lines, and produce output with one line per paragraph, like this:
now is the time for all good men
to come to the aid of their country
Usually, I would do this in vim, but that's not a totally automated solution.
GNU fmt works up to an output width of 2500 characters per line:
fmt -w 2500
It could also be done with something like:
while read LINE; do
if [ -z "$LINE" ]; then
echo
else
echo -n " $LINE"
fi
done | cut -c2-
but I imagine there has to be a less verbose solution.
