Nп/п : 84 из 85
От : Grant Weasner 1:138/397 19 май 25 11:48:11
К : Dan Clough 19 май 25 21:56:02
Тема : Re: text reformating
----------------------------------------------------------------------------------
@MSGID: 271.fidonet_linux@1:138/397 2c90b3fa
@REPLY: 2255.fido_linux@1:135/115 2c907235
@TZUTC: -0700
@PID: Synchronet 3.20a-Linux master/57c2367a5 Sep 18
202 GCC 10.2.1
@TID: SBBSecho 3.20-Linux master/57c2367a5 Sep 18
2024 22:26 GCC 10.2.1
@COLS: 132
@BBSID: LUNAROUT
@CHRS: ASCII 1
@NOTE: FSEditor.js v1.105
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.
>
>
>
> 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)
SEEN-BY: 1/120 18/0 50/13 279 103/705 104/119
114/10 116/116 120/616 123/0 25
SEEN-BY: 123/126 180 525 755 3001 3002 124/5016
135/115 138/142 146 397
SEEN-BY: 153/757 7001 7715 154/10 30 50 700 203/0
220/6 20 30 90 221/0 6
SEEN-BY: 222/2 226/18 44 50 229/310 426 240/1120
5832 250/1 263/1 275/100
SEEN-BY: 275/1000 280/464 5003 292/854 8125 301/1
310/31 341/66 234 342/11
SEEN-BY: 396/45 423/120 460/58 467/888 633/280
712/848 1321 1321 770/1
SEEN-BY: 2320/105 3634/0 12 27 56 57 58 60 119
5020/400 545 848 1042 1477
SEEN-BY: 5020/4441 12000 5025/3 75 5030/1081 1900
1957 2404 5037/7 5053/58
SEEN-BY: 5060/900 5066/18 5080/102 5095/20
6078/80
@PATH: 138/397 153/7715 3634/12 154/10 280/464
5020/545 4441