word wrap command line tool

I just couldn’t find one, so I ended up using this line:

cat <textfile> | perl -e 'use Text::Wrap;$Text::Wrap::columns=70;
while(<>) {print wrap("","",$_)}'

2 Gedanken zu „word wrap command line tool

  1. @Kevin: Thanks. That’s what I was looking for. But very hard to find if you search for „word wrap“.
    fmt -s -w70 does almost the same as this perl line. The fine difference is, that fmt doesn’t split words, that are longer than the line width.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.