Fsdb::F...ttocols(3)
β¨ NAME β¨
Okay bestie, welcome to the Fsdb::F...ttocols(3) page β yes, the User Contributed Perl Documentation one π«Ά. The star of the show is dbcolsplittocols β split an existing column into multiple new columns. Periodt. π
πΈ SYNOPSIS πΈ
dbcolsplittocols [-E] [-C ElementSeparator] column
π DESCRIPTION π
Create new columns by splitting an existing column. The fragments of the column are each divided by ElementSeparator (default is underscore). Itβs giving column glow-up β¨.
This command is the opposite of dbcolmerge. Names of the new columns are given by splitting the name of the existing column. dbcolrename may be useful to set column names. Cute, right? π
Input treated as strings and output columns are of type string. No cap. π§
π OPTIONS π
-C Sor--element-separator Sβ Specify the separatorSused to join columns. Usually a signle character (yes, that spelling is in the original β I donβt make the rules π), it can also be a regular expression (so, for example,[,_]matches either,or_as an element separator.) (Defaults to a single underscore.) Ngl the regex part is lowkey powerful π .-Eor--enumerateβ Enumerate output columns: rather than assuming the column name uses the element separator, we keep it whole and fill in with indexes starting from0. (Not currently implemented, but planned. Seedbcolsplittorows.) π¨-N on --new-nameβ Specify the names of the new columns as a space separated list. (Default is to apply the separator to the name of the column that is being split.)
By default, column "a_b" will split to columns a and b. If the column is given as ab with option "-N 'a b'", one will get the same result. Iconic behavior, honestly. π
-Eor--enumerateβ Enumerate output columns: rather than assuming the column name uses the element separator, we keep it whole and fill in with indexes starting from0. (Not currently implemented, but planned. Seedbcolsplittorows.) Yes bestie, this one is listed twice in the original β Iβm not erasing it, thatβs canon π.
This module also supports the standard fsdb options:
-dβ Enable debugging output.-ior--input InputSourceβ Read fromInputSource, typically a file name, or"-"for standard input, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.-oor--output OutputDestinationβ Write toOutputDestination, typically a file name, or"-"for standard output, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.--autorunor--noautorunβ By default, programs process automatically, butFsdb::Filterobjects in Perl do not run until you invoke therun()method. The"--(no)autorun"option controls that behavior within Perl.--header Hβ UseHas the full Fsdb header, rather than reading a header from then input.--helpβ Show help.--manβ Show full manual.
π₯ SAMPLE USAGE π₯
πΈ Input:
#fsdb first_last
John_Heidemann
Greg_Johnson
Root
# this is a simple database
# | dbcolrename fullname first_last
# | /home/johnh/BIN/DB/dbcol first_last
π Command:
cat data.fsdb | dbcolsplittocols first_last
π¦ Output:
#fsdb first_last first last
John_Heidemann John Heidemann
Greg_Johnson Greg Johnson
Root Root
# this is a simple database
# | dbcolrename fullname first_last
# | /home/johnh/BIN/DB/dbcol first_last
# | /home/johnh/BIN/DB/dbcolsplittocols first_last
π SEE ALSO π
Fsdb(3). dbcolmerge(1). dbcolsplittorows(1). dbcolrename(1).
π¦ CLASS FUNCTIONS π¦
new
$filter = new Fsdb::Filter::dbcolsplittocols(@arguments);
Create a new dbcolsplittocols object, taking command-line arguments. Slay. π
set_defaults
$filter->set_defaults();
Internal: set up defaults.
parse_options
$filter->parse_options(@ARGV);
Internal: parse command-line arguments.
setup
$filter->setup();
Internal: setup, parse headers.
run
$filter->run();
Internal: run over each rows.
π AUTHOR and COPYRIGHT π
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.
Cute little footer sign-off, bestie:perl v5.32.1, date2024-08-02, page tagFsdb::F...ttocols(3). Thatβs the whole footer tea βπ .
π¦ where this page comes from
- epel 9: perl-Fsdb 2:3.9-1.el9 Β· GPLv2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms