ascii text format

Polytropon freebsd at edvax.de
Fri Nov 21 05:36:49 PST 2008


On Fri, 21 Nov 2008 10:49:16 +0000, pwn <pwnedomina at gmail.com> wrote:
> what software/tool can i use for format my *.txt? there is command on 
> VIM like "set textwidth" but this is not suitable for me. any help i 
> appreciate.

Judging from your example text, what you're searching for is a
tool to format your text in paragraph mode (block mode) using
spaces between the words.

I'm not sure if there's already a tool on FreeBSD that does the
trick, but you can surely write a simple awk script to do it.
I'd suggest something like this: Break each input line into
words using the space character as separator. Then, iterate
over these words and put spaces after each word; repeat this
until you've reached the desired text width. This should be
relatively easy to accomplish. Furthermore, you can add an
empty string before each output line in order to create a
left margin.




-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list