Fsdb::F...r::dbcol(3)

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

πŸ’… dbcol β€” like, the manual page, but make it make sense ✨

Okay bestie, so this is Fsdb::F...r::dbcol(3) from the User Contributed Perl Documentation, and I'm gonna walk you through it like we're texting at 1am. Stay with me, it's actually so good. 🫢


🌸 NAME 🌸

dbcol β€” pick which columns you want out of an Fsdb file. That's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

dbcol [-v] [-e -] [column...]

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically you're selecting one or more columns from the input database, periodt. πŸ’…

Now here's the cute part: if you hand a value to the empty columns using the -e option, then any named columns that don't exist get created for you. Iconic. But if you don't do that? Non-existent columns are just an error, no cap. 😭

Note: a safer way to create columns is dbcolcreate. Just saying. πŸŽ€

🌈 OPTIONS 🌈

  • -r, --relaxed-errors β€” relaxed error checking, meaning it just ignores columns that aren't there. Very chill of it. 🧚
  • -v, --invert-match β€” outputs all the columns except the ones you listed, exactly like grep -v. Flip the script bestie. πŸ”₯
  • -a, --all β€” outputs all the columns, in addition to the ones you listed. (So like, -a foo will move column foo to be the first column. Sneaky but slay.) πŸ‘‘
  • -e EmptyValue, --empty β€” specify the value that newly created columns get. πŸ“
  • --saveoutput $OUT_REF β€” save the output writer (this is for integration with other fsdb filters, iykyk).

And then there's the standard fsdb options, which are also giving main character energy:

  • -d β€” enable debugging output. πŸ›
  • -i, --input InputSource β€” read from InputSource, which is typically a file, or - for standard input, or (if you're in Perl) IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
  • -o, --output OutputDestination β€” write to OutputDestination, typically a file, 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.
  • --header H β€” use H as the full Fsdb header, rather than reading a header from then input.
  • --help β€” show help. πŸ™‹
  • --man β€” show the full manual. πŸ“–

πŸ’€ SAMPLE USAGE πŸ’€

Input:

#fsdb account passwd uid gid fullname homedir shell
johnh * 2274 134 John_Heidemann /home/johnh /bin/bash
greg * 2275 134 Greg_Johnson /home/greg /bin/bash
root * 0 0 Root /root /bin/bash
# this is a simple database

Command:

cat DATA/passwd.fsdb account | dbcol account

Output:

#fsdb      account
johnh
greg
root
# this is a simple database
#  | dbcol account

See how it just… kept account and dropped everything else? Obsessed. πŸ’œ


πŸ” SEE ALSO πŸ”

dbcolcreate(1), Fsdb(3)


πŸŽ€ CLASS FUNCTIONS πŸŽ€

new

$filter = new Fsdb::Filter::dbcol(@arguments);

Create a new dbcol object, taking command-line arguments. Fresh out the box. ✨

set_defaults

$filter->set_defaults();

Internal: set up defaults.

parse_options

$filter->parse_options(@ARGV);

Internal: parse options.

setup

$filter->setup();

Internal: setup, parse headers.

run

$filter->run();

Internal: run over all data rows. Go go go. πŸ”₯

finish

$filter->finish();

Internal: write trailer.


Copyright (C) 1991-2022 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.


Okay that's the whole thing, you ate that. πŸ’…βœ¨

And for the sign-off, since you asked so nicely: this was perl v5.32.1, dated 2024-08-02, and yes, it's still Fsdb::F...r::dbcol(3) β€” mwah, bye bestie! πŸ’–πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from