Subj : Re: text reformating
To   : Dan Clough
From : Grant Weasner
Date : Mon May 19 2025 11:48 am

 Re: Re: text reformating
 By: Dan Clough to Grant Weasner on Mon May 19 2025 08:34:30

> -=> Grant Weasner wrote to All <=-
>
>  GW> Hello all.
>
>  GW> I'm wondering what others think about linux a text formating task I'm trying to solve.
>
>  GW> I've got lots of older howtos from the old web, and stuff I've also
>  GW> wrote.
>
>  GW> I want to convert all of my text files in many directories into a
>  GW> gopher fiendly format.
>
>  GW> Gopher friendly:
>  GW> 1) 64 columns wide.
>  GW> 2) any indents will remain, but if a line goes beyond 64 cols, the remaining characters will go to the line below but
>  GW> indent
>  GW> to the same column as the prior line.
>
>
>  GW> This seems pretty difficult and I'm wondering how others would approch this task.
>
>  GW> I'm thinking of just writing a python script using basic python
>  GW> modules.
>
>  GW> But I'm wondering if there are just native linux tools that would work
>  GW> as good or  better.
>
> <SNIP>
>
> man fold

Thanks Dan.

fold -sw 64 file.txt

-s = break on spaces
-w width of text
---------------------

Fold produced pretty good results, and very quick. It does doesn't add indents to the prior linae, but still pretty good.

I think this will work well. I really was trying to get any break that had an indent on the prior line would have to concatenate the line below then indent every line beolw until it sees a line where there is no indent. This is pretty difficult. Fun project but time consuming.

The EXAMPLE AFTER text looks more like paragraphs, which is still nice.

There are some areas of that document that get really mangled where there are two columns of text. I hadn't really though of how to deal with that.

Something like:
 1) here is a left area of text           * here is a right area of text
 2) here is a left area of text           * here is a right area of text

So I think I've added even more complexity. :( :)


EXAMPLE BEFORE:
---------------------------

# cat /etc/anacrontab
7       15      test.daily      /bin/sh /home/sathiya/backup.sh

 START_HOURS_RANGE and RANDOM_DELAY

  The above example indicates that the backup.sh script should be executed every day, with a delay of 15 mins. i.e When the laptop was started, executed it only after 15 minutes.

EXAMPLE AFTER:
---------------------------

# cat /etc/anacrontab
7       15      test.daily      /bin/sh /home/sathiya/backup.sh

 START_HOURS_RANGE and RANDOM_DELAY

  The above example indicates that the backup.sh script should
be executed every day, with a delay of 15 mins. i.e When the
laptop was started, executed it only after 15 minutes.
--- SBBSecho 3.20-Linux
* Origin: Lunar Outpost - lunarout.synchro.net (1:138/397)