Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Nov 2008 14:36:43 +0100
From:      Polytropon <freebsd@edvax.de>
To:        pwn <pwnedomina@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: ascii text format
Message-ID:  <20081121143643.b732042a.freebsd@edvax.de>
In-Reply-To: <4926922C.8050702@gmail.com>
References:  <4926922C.8050702@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 21 Nov 2008 10:49:16 +0000, pwn <pwnedomina@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, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081121143643.b732042a.freebsd>