HTML_TABLE_TO_DB(1)

πŸ“¦
version 3.9 Β· 3 versions
, in epel 9

πŸ’… HTML_TABLE_TO_DB β€” a Perl user-contributed manual page, bestie πŸŽ€

okay so you found html_table_to_db, and honestly? she's iconic. this is one of the user-contributed Perl doc pages (perl v5.32.1 energy, we'll get to that at the end 🫢), and she does exactly one thing and does it beautifully: she takes an HTML table and turns it into fsdb. that's it. that's the gig. 🌸


✨ NAME ✨

html_table_to_db β€” convert HTML tables into fsdb 😌


🌈 SYNOPSIS 🌈

html_table_to_db <source.html >dest.fsdb

like, pipe in, pipe out, no drama. periodt. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first things first: this bad boy converts a HTML table to Fsdb format. πŸŽ€

the input is an HTML table β€” not fsdb, bestie, do not come in here with fsdb, that's not what we do. where do the column names come from? you have options, literally:

  • if there are TH elements, the column names come from those ✨
  • if there are no such elements, they get defined as column0 through columnN (yes, really, that's the fallback, she's doing her best πŸ™ˆ)

the output is two-space-separated fsdb. and ngl, the manpage itself says it: (Someday more general field separators should be supported.) β€” so like, manifesting that for future us πŸ•―οΈ. also, fsdb fields are a normalized version of the HTML file: multiple spaces are compressed to one. no cap. πŸ’―

this module also supports the standard fsdb options, let's go πŸ”₯:

  • -d β€” enable debugging output. turn it on, see the vibes. πŸ›
  • -i or --input InputSource β€” read from InputSource, which is typically a file name, or - for standard input, or (if you're in Perl πŸ‘€) IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
  • -o or --output OutputDestination β€” write to OutputDestination, typically a file name, or - for standard output, or (if you're in Perl πŸ‘€) IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
  • --autorun or --noautorun β€” by default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. the --(no)autorun option controls that behavior within Perl. main character energy only when you call her. πŸ‘‘
  • --help β€” show help. bless. 🫢
  • --man β€” show full manual. hi, you are here. πŸ“–

πŸ“ SAMPLE USAGE πŸ“

🌸 Input:

    <table>
    <tr><th>account</th> <th>passwd</th> <th>uid</th> <th>gid</th> <th>fullname</th> <th>homedir</th> <th>shell</th> </tr>
    <tr bgcolor="#f0f0f0"><td>johnh</td> <td>*</td> <td>2274</td> <td>134</td> <td>John &amp; Ampersand</td> <td>/home/johnh</td> <td>/bin/bash</td> </tr>
    <tr bgcolor="#f0f0f0"><td>greg</td> <td>*</td> <td>2275</td> <td>134</td> <td>Greg &lt; Lessthan</td> <td>/home/greg</td> <td>/bin/bash</td> </tr>
    <tr bgcolor="#f0f0f0"><td>root</td> <td>*</td> <td>0</td> <td>0</td> <td>Root ; Semi</td> <td>/root</td> <td>/bin/bash</td> </tr>
    <tr bgcolor="#d0d0d0"><td>four</td> <td>*</td> <td>1</td> <td>1</td> <td>Fourth Row</td> <td>/home/four</td> <td>/bin/bash</td> </tr>
    </table>

πŸ’œ Command:

    html_table_to_db

🧚 Output:

    #fsdb -F S account passwd uid gid fullname homedir shell
    johnh  *  2274  134  John & Ampersand  /home/johnh  /bin/bash
    greg  *  2275  134  Greg < Lessthan  /home/greg  /bin/bash
    root  *  0  0  Root ; Semi  /root  /bin/bash
    four  *  1  1  Fourth Row  /home/four  /bin/bash

see how &amp; became & and &lt; became <? and how everything's two-space-separated? chef's kiss πŸ˜­πŸ’– she ate.


⭐ SEE ALSO ⭐

  • Fsdb.
  • db_to_html_table. (yes, the reverse queen, go say hi πŸ‘‹)

Copyright (C) 1991-2015 by John Heidemann <johnh@isi.edu> 🫢

This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details. (fr fr, read the license, it's the rules πŸ“œ)


okay and for the cute sign-off: this little masterpiece is perl v5.32.1, dated 2024-08-02, filed under HTML_TABLE_TO_DB(1) β€” and that's the whole vibe check, bestie. go convert some tables. ily. πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from