• Re: text reformating

    From Dan Clough@1:135/115 to Sean Dennis on Mon May 19 20:54:16 2025
    Sean Dennis wrote to Dan Clough <=-

    Dan Clough wrote to Grant Weasner <=-

    man fold

    fold is an amazing utility. Very helpful with text files.

    Indeed it is. A classic *nix utility - do one thing, and do it well.

    When I was publishing th FidoGazette, I used fold a lot in
    reformatting,

    Yes, very handy for making "wide" stuff fit on a 80x25 character screen.
    :-)



    ... She kept saying I didn't listen to her, or something like that.
    === MultiMail/Linux v0.52
    --- SBBSecho 3.25-Linux
    * Origin: Palantir * palantirbbs.ddns.net * Pensacola, FL * (1:135/115)
  • From Nigel Reed@1:124/5016 to All on Mon May 19 21:10:44 2025
    On Mon, 19 May 2025 20:54:16 -0500
    "Dan Clough" (1:135/115) <Dan.Clough@f115.n135.z1.fidonet> wrote:

    Sean Dennis wrote to Dan Clough <=-

    Dan Clough wrote to Grant Weasner <=-

    man fold

    fold is an amazing utility. Very helpful with text files.

    Indeed it is. A classic *nix utility - do one thing, and do it well.

    When I was publishing th FidoGazette, I used fold a lot in
    reformatting,

    Yes, very handy for making "wide" stuff fit on a 80x25 character
    screen. :-)

    So many useful, and maybe not so useful utilities out there.

    paste, will take 2 or more files and put them next to each other, like
    a sideways cat :)

    Talking of cat, there is also tac which will display a file from the
    bottom up.

    ncal is like cat but with the days down the side.

    To randomly shuffle the lines of a text file you can pipe it into shuf

    fmt is another text processor similar to, but different from fold.
    --
    End Of The Line BBS - Plano, TX
    telnet endofthelinebbs.com 23
    --- SBBSecho 3.27-Linux
    * Origin: End Of The Line BBS - endofthelinebbs.com (1:124/5016)
  • From Dan Cross@3:770/100 to Grant Weasner on Wed May 21 00:53:25 2025
    On 19 May 2025 at 01:24a, Grant Weasner pondered and said...

    I want to convert all of my text files in many directories into a gopher fiendly format.

    Gopher friendly:
    1) 64 columns wide.
    2) any indents will remain, but if a line goes beyond 64 cols, the remaining characters will go to the line below but indent to the same column as the prior line.

    This seems pretty difficult and I'm wondering how others would approch this task.

    `fmt` or `par`.

    --- Mystic BBS v1.12 A48 (Linux/64)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (3:770/100)
  • From Dan Clough@1:135/115 to Nigel Reed on Tue May 20 08:16:35 2025
    Nigel Reed wrote to All <=-

    Dan Clough wrote to Grant Weasner <=-

    man fold

    fold is an amazing utility. Very helpful with text files.

    Indeed it is. A classic *nix utility - do one thing, and do it well.

    When I was publishing th FidoGazette, I used fold a lot in reformatting,

    Yes, very handy for making "wide" stuff fit on a 80x25 character
    screen. :-)

    So many useful, and maybe not so useful utilities out there.

    paste, will take 2 or more files and put them next to each other, like
    a sideways cat :)

    Talking of cat, there is also tac which will display a file from the bottom up.

    ncal is like cat but with the days down the side.

    To randomly shuffle the lines of a text file you can pipe it into shuf

    fmt is another text processor similar to, but different from fold.

    Nice! Didn't know about a couple of those, thanks.



    ... Rehab is for quitters.
    === MultiMail/Linux v0.52
    --- SBBSecho 3.25-Linux
    * Origin: Palantir * palantirbbs.ddns.net * Pensacola, FL * (1:135/115)
  • From Grant Weasner@1:138/397 to Sean Dennis on Fri May 23 18:57:51 2025
    Re: Re: text reformating
    By: Sean Dennis to Dan Clough on Mon May 19 2025 18:41:09

    Dan Clough wrote to Grant Weasner <=-

    man fold

    fold is an amazing utility. Very helpful with text files.

    When I was publishing th FidoGazette, I used fold a lot in reformatting,

    Thanks for all how replied.

    I'm still working on how I'm going format all the strange "info" files I've collected over the years.

    fold works great for some stuff. fold with sed helps too, but I've got some requirements that seem to require some programming. In my spare time (between feeds with twins) I've been slowly working at it.

    If I ever get done with it (about 25% of the way) I'll post my solution here. --- SBBSecho 3.20-Linux
    * Origin: Lunar Outpost - lunarout.synchro.net (1:138/397)
  • From Maurice Kinal@1:153/7001 to Grant Weasner on Sat May 24 03:00:31 2025
    Hey Grant!

    I'm still working on how I'm going format all the strange "info"
    files I've collected over the years.

    Have you looked at makeinfo, which comes with the texinfo package? 'makeinfo --help' reports 'makeinfo --plaintext foo.texi' which offhand looks to me what you're looking for.

    Life is good,
    Maurice

    o- o- -o o-
    /) /) (\ /)
    ^^ ^^ ^^ ^^
    ... ðone wisdom ðe ðe God sealde ðær ðær ðu hiene befæstan mæge, befæste.
    Wherever you can use the wisdom God gave you, use it.
    --- GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's Brain - Ladysmith BC, Canada (1:153/7001)
  • From Maurice Kinal@1:153/7001 to Gerrit Kuehn on Tue May 27 22:04:26 2025
    Hey Gerrit!

    There is usually a command named "texi2any"

    On my systems "makeinfo" is a symlink to "texi2any". The little I've used it directly would explain why I posted it as "makeinfo".

    installed with the texinfo package that does exactly this.

    I would hope so! Something would be amiss if that weren't true.

    Life is good,
    Maurice

    o- -o -o -o
    /) (\ (\ (\
    ^^ ^^ ^^ ^^
    ... Ne sceal man to ær forht ne to ær fægen.
    One should not be too soon fearful nor too soon joyful.
    --- GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's Brain - Ladysmith BC, Canada (1:153/7001)
  • From Kai Richter@2:240/77 to Grant Weasner on Wed May 28 15:03:50 2025
    Hello Grant!

    19 May 25, Grant Weasner wrote to All:

    Gopher friendly:
    1) 64 columns wide.
    2) any indents will remain, but if a line goes beyond 64 cols, the remaining characters will go to the line below but indent to the same column as the prior line.

    This seems pretty difficult and I'm wondering how others would
    approch this task.

    Indent to the same column as the prior line - that sounds like the man manpages layout?

    If yes then you may like to peek into the manpage display processes for more hints.

    Regards

    Kai

    --- GoldED+/LNX 1.1.4.7
    * Origin: Monobox (2:240/77)
  • From Grant Weasner@1:138/397 to Kai Richter on Wed Jun 4 10:47:15 2025
    Re: text reformating
    By: Kai Richter to Grant Weasner on Wed May 28 2025 15:03:50

    Hi Kai,


    Gopher friendly:
    1) 64 columns wide.
    2) any indents will remain, but if a line goes beyond 64 cols, the remaining characters will go to the line below but
    indent
    to the same column as the prior line.

    Indent to the same column as the prior line - that sounds like the man manpages layout?
    Yes I'm working on the algorithm for the process.

    So far its counting the proceeding whitespace starting at char[0] for the line, and finding any '\t' tabs as well.
    If the next line proceeding whitespace is equal to current line, read the next->next line check for equal whitespace. Repeat the process until whitespace is not equal, or whitespace is equal but directly after whietspace there is a '\n'.
    create new lines with current whitespace for every joined line.



    If yes then you may like to peek into the manpage display processes for more hints.

    I looked at man man, but I wasn't sure what I was looking for. Lots of references to groff within man man.
    --- SBBSecho 3.20-Linux
    * Origin: Lunar Outpost - lunarout.synchro.net (1:138/397)
  • From Maurice Kinal@2:280/464.113 to Grant Weasner on Wed Jun 4 18:20:51 2025
    Hej Grant!

    and finding any '\t' tabs as well.

    'col -x' will replace tabs with spaces.

    $ echo -e '\tSome text.' | wc -c
    12

    $ echo -e '\tSome text.' | col -x | wc -c
    19

    You'll probably want to replace tabs before counting characters.

    Het leven is goed,
    Maurice

    -o o- o- o-
    (\ /) /) /)
    ^^ ^^ ^^ ^^
    ... Gif ðu wille godne hlisan habban, ne fægna ðu nanes yfeles.
    If you want to have a good reputation, don't rejoice in any evil.
    --- GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
    * Origin: Little Mikey's EuroPoint @ (2:280/464.113)
  • From Kai Richter@2:240/77 to Grant Weasner on Thu Jun 5 16:53:42 2025
    Hello Grant!

    04 Jun 25, Grant Weasner wrote to Maurice Kinal:

    In my original post I had chosen 64 columns wide is from the link
    below, so my gopher pages could have enough width left over to pretty
    some of the text with boxes.

    This display/format/layout problem is the reason why markup languages have been invented. For example css within html or markdown on github readme.md files.

    If you are not looking for a one time conversion then text processing workflow may be a good idea. You could keep two text files, one for easy human editing and the output of text processing for the gopher files.

    troff/groff have its own markup language. For example:
    .ll 67
    sets the line lenght to 67 chars
    .sp 2
    insert two blank lines.

    The groff system can do macros. Some examples and better than mine explanations can be found here:

    https://www.davebucklin.com/play/2018/03/04/gopher-groff.html

    For the manpages format there is an existing macro set called "groff an.tmac" macro package or man macro package. I think it comes with man usually, because on my outdated system it can be found with "man 7 man". There are macros for relative margin indent and indented paragraph macros.

    Regards

    Kai

    --- GoldED+/LNX 1.1.4.7
    * Origin: Monobox (2:240/77)