So I have some output that has very long lines, and I want to have it formatted to lines no more than 80 columns wide, but I don't want to split words because they are in the column limit.I tried sed 's/.\{80\}/&\n/g' but has the problem of splitting words and making some lines begin with a space.I managed to do it with Vim, setting textwidth to 80, going to the beginnig of the file and executing gqG to format the text. But  would rather do it with sed, awk or something similar to include it in a script.
Format output to a specific line length
text processing;sed;awk;text
Use fmt instead:fmt --width=80 fileFrom man fmt:-w, --width=WIDTH              maximum line width (default of 75 columns)