DBCOLSPLITTOROWS(1)

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

πŸ‘‘ DBCOLSPLITTOROWS(1) β€” dbcolsplittorows, aka the glow-up column splitter πŸ’…

okay bestie, sit down because this little icon does ONE thing and it does it flawlessly: it takes a column you already have and ✨splits✨ it into a bunch of new rows. the manpage name is dbcolsplittorows and yes it's part of the Fsdb fam. no cap, it's giving "divide and conquer" energy.


✨ SYNOPSIS ✨

dbcolsplittorows [-C ElementSeperator] [-e null] [-E] [-N
enumerated-name] column [column...]

literally that's it. hand it a column (or several, go off πŸ‘‘) and it does the thing.


🌸 DESCRIPTION 🌸

So here's the vibe: you point it at column, it splits that column into pieces, and then it outputs one row for each piece. simple as that, fr fr.

By default, any empty fields are ignored β€” like, they don't get an invite to the party πŸ™ˆ. But if you do pass an empty field value with -e, then they produce output. so it's your call, bestie.

When a null value is given, empty fields at the beginning and end of lines are suppressed (think of it like how perl split behaves πŸͺ). But β€” and this is the plot twist β€” unlike perl, if ALL fields are empty, we generate one (and not zero) empty fields. yes, one. always at least one. the show must go on πŸ’€.

And the inverse of this command is dbfilepivot. so if you ever need to go backwards, you know where to find it 🫢.


πŸŽ€ OPTIONS πŸŽ€

  • -C S or --element-separator S β€” specify the separator used to split columns. (defaults to a single underscore _, iconic and lowkey)
  • -E or --enumerate β€” enumerate output columns! instead of assuming the column name uses the element separator, we keep it whole and fill in with indexes starting from 0. numbers go brrr πŸ”’
  • -N or --new-name N β€” name the new column N for enumeration. defaults to "index" ✨
  • -e E or --empty E β€” give value E as the value for empty (null) records πŸ«™

This module also supports the standard fsdb options:

  • -d β€” enable debugging output. πŸ›
  • -i or --input InputSource β€” read from InputSource, typically a file name, or "-" for standard input, or (if in Perl) a 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 in Perl) a 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. πŸ”₯
  • --help β€” show help. πŸ†˜
  • --man β€” show full manual. πŸ“–

πŸ¦‹ SAMPLE USAGE πŸ¦‹

πŸ’œ Input:

#fsdb name uid
John_Heidemann  2274
Greg_Johnson    2275
Root    0
# this is a simple database
#  | dbcol fullname uid
#  | dbcolrename fullname name

πŸ’œ Command:

cat data.fsdb | dbcolsplittorows name

πŸ’œ Output:

#fsdb name uid
John    2274
Heidemann       2274
Greg    2275
Johnson 2275
Root    0
# this is a simple database
#  | dbcol fullname uid
#  | dbcolrename fullname name
#  | dbcolsplittorows name

see how John_Heidemann became two whole rows?? that underscore said "my time has come" and dipped 😭. Root had no underscore so it stayed exactly as it was β€” main character energy, no split needed.


🌈 SEE ALSO 🌈

Fsdb(1). dbcolmerge(1). dbcolsplittocols(1). dbcolrename(1). dbfilepvot(1).

like, go read those too. they're friends of the family 🫢


Copyright (C) 1991-2018 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 page, bestie, you're officially an expert 🧚✨ β€” and for the record, this slay was brought to you by perl v5.32.1, dated 2024-08-02, and it's DBCOLSPLITTOROWS(1) all day every day. periodt πŸ’…πŸŽ€

πŸ“¦ where this page comes from