DBMERGE(1)

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

πŸ’… DBMERGE(1) β€” like, the merge manual, bestie

okay so real quick: this is dbmerge from the User Contributed Perl Documentation section of the manual, and honestly? she's an icon. let's get into it 🫢


✨ NAME ✨

dbmerge β€” merge all your inputs into one sorted result, sorted by the columns you specifiy. yes. the columns. the ones you named. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

dbmerge --input A.fsdb --input B.fsdb [-T TemporaryDirectory] [-nNrR] column [column...]

or

cat A.fsdb | dbmerge --input - --input B.fsdb [-T TemporaryDirectory] [-nNrR] column [column...]

or

dbmerge [-T TemporaryDirectory] [-nNrR] column [column...] --inputs A.fsdb [B.fsdb ...]

or

{ echo "A.fsdb"; echo "B.fsdb" } | dbmerge --xargs column [column...]

🌸 DESCRIPTION 🌸

So the whole vibe: you hand her a bunch of pre-sorted input files and she merges them all into one sorted result. that's it, that's the post πŸ’–

You can name your inputs with --input, or with --inputs, or do the cute mixed thing where one comes from standard input and the other comes from --input. And with --xargs, every single line of standard input is a filename for input. one per line, no cap.

⚠️ heads up bestie: inputs must have identical schemas β€” same columns, same column order, and same field separators. no mixing and matching, she will not be doing that πŸ™ˆ

Unlike dbmerge2, dbmerge supports an arbitrary number of input files. literally as many as you want. main character energy πŸ‘‘

And because this program is built to merge multiple sources, she does not default to reading from standard input. you want stdin? use - as the input source. periodt.

Also, because we're dealing with multiple input files, this module doesn't output anything until it's run. like, nothing. she's cooking. πŸ”₯

dbmerge consumes a fixed amount of memory regardless of input size. iconic. so she buffers output on disk as necessary. (the merging is implemented as a series of two-way merges and possibly an n-way merge at the end, so disk space is O(number of records).)

dbmerge will merge data in parallel, if possible. the --parallelism option can control the degree of parallelism, if you're feeling controlling πŸŽ€


✨ OPTIONS ✨

general option(s):

  • --xargs β€” expect that input filenames are given, one-per-line, on standard input. (in this case, merging can start incrementally. slay.)
  • --removeinputs β€” delete the source files after they've been consumed. (defaults off, so your inputs stay right where they are πŸ’–)
  • -T TmpDir β€” where to put tmp files. also uses the environment variable TMPDIR if -T isn't specified. default is /tmp.
  • --parallelism N or -j N β€” allow up to N merges to happen in parallel. default is the number of CPUs in the machine. she's built different.
  • --endgame (or --noendgame) β€” enable endgame mode, extra parallelism when finishing up. (on by default. we love a strong finish 🫢)

sort specification options (these can be interspersed with column names, iykyk):

  • -r or --descending β€” sort in reverse order (high to low)
  • -R or --ascending β€” sort in normal order (low to high)
  • -n or --numeric β€” sort numerically
  • -N or --lexical β€” sort lexicographically

also, this module 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.
  • --header H β€” use H as the full Fsdb header, rather than reading a header from then input.
  • --help β€” show help. πŸ₯Ί
  • --man β€” show full manual. (hi, that's this πŸ’…)

πŸŽ€ SAMPLE USAGE πŸŽ€

input:

File a.fsdb:

#fsdb cid cname
11 numanal
10 pascal

File b.fsdb:

#fsdb cid cname
12 os
13 statistics

These two files are both sorted by "cname", and they have identical schemas. perfect match, honestly 🌈

command:

dbmerge --input a.fsdb --input b.fsdb cname

or

cat a.fsdb | dbmerge --input b.fsdb cname

output:

#fsdb      cid     cname
11 numanal
12 os
10 pascal
13 statistics
#  | dbmerge --input a.fsdb --input b.fsdb cname

like?? ate and left no crumbs πŸ‘‘


🌈 SEE ALSO 🌈

dbmerge2(1), dbsort(1), Fsdb(3)

go read those too, bestie, they're all part of the family πŸ¦‹


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


and that's the whole page, bestie ✨ this one's from perl v5.32.1, dated 2024-08-02, and it's DBMERGE(1) β€” go merge something iconic πŸ’…πŸŽ€

πŸ“¦ where this page comes from