DBSORT(1)
π dbsort β the row-sorting bestie (perl manual, User Contributed Perl Documentation) π
okay so picture this: you've got rows. lots of rows. and you're like "girl, these need to be sorted" β that's literally what dbsort is for. it sorts rows based on the columns you tell it about. no cap. β¨
πΈ SYNOPSIS πΈ
dbsort [-M MemLimit] [-T TemporaryDirectory] [-nNrR] column [column...]
that's it. that's the whole vibe. you hand it columns, it hands you sorted rows. π«Ά
β¨ DESCRIPTION β¨
so dbsort sorts every single input row as specified by the numeric or lexical columns you list. all of them. the whole squad. π
here's the iconic part: dbsort consumes a fixed amount of memory regardless of input size β like, your input can be huge and it's still gonna be chill about RAM. (it reverts to temporary files on disk if necessary, based on the -M and -T options. so yes, it spills to disk when it has to. respect.)
the sort should be stable, but β and I cannot stress this enough β this has not yet been verified. so like, it's probably stable. probably. π
and for large inputs (the ones that spill to disk, bestie), dbsort will do some of the merging in parallel, if possible. the --parallelism option can control the degree of parallelism, if desired. multitasking queen behavior. π
π₯ OPTIONS π₯
general option:
-MMaxMemBytes β specify an approximate limit on memory usage (in bytes). larger values allow faster sorting because more operations happen in-memory, provided you have enough memory. so like, if you got the RAM, flex it. π-TTmpDir β where to put tmp files. also uses environment variableTMPDIR, if-Tis not specified. default is/tmp. ποΈ--parallelismN or-jN β allow up to N merges to happen in parallel. default is the number of CPUs in the machine. she matches your hardware's energy. β‘
sort specification options (can be interspersed with column names):
-ror--descendingβ sort in reverse order (high to low). we're going down, down, down. π-Ror--ascendingβ sort in normal order (low to high). the classic. the original. the main character. π-tor--type-inferred-sortingβ sort fields by type (numeric or leicographic), automatically. yes it handles the thinking for you. yes it's a little smarty pants. β¨-Tor--no-type-inferred-sortingβ sort fields only as specified based on-nor-N. no vibes, no guessing, just the rules. π―-nor--numericβ sort numerically. numbers get number treatment. π’-Nor--lexicalβ sort lexicographically. words get word treatment. π
okay bestie, heads up:-Tdoes double duty here. with a TmpDir argument it's the temp directory option, and without one it's--no-type-inferred-sorting. context is everything, iykyk. π
π¦ standard fsdb options (this module supports them too) π¦
-dβ enable debugging output. for when you need to see the receipts. π-ior--inputInputSource β read from InputSource, typically a file name, or-for standard input, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects. π-oor--outputOutputDestination β write to OutputDestination, 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)autorunoption controls that behavior within Perl. β--headerH β use H as the full Fsdb header, rather than reading a header from then input. (yes "then input" β we quote the manual faithfully, don't @ me.) π--helpβ show help. we love a helpful icon. π«Ά--manβ show full manual. the one you're reading right now. meta moment. π§
π SAMPLE USAGE π
input:
#fsdb cid cname
10 pascal
11 numanal
12 os
command:
cat data.fsdb | dbsort cname
output:
#fsdb cid cname
11 numanal
12 os
10 pascal
# | dbsort cname
look at that. numanal, os, pascal β alphabetical and gorgeous. ate and left no crumbs. π
β¨
π SEE ALSO π
dbmerge(1), dbmapreduce(1), Fsdb(3) β the whole friend group, honestly. go say hi. π¦
π AUTHOR and COPYRIGHT π
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.
and that's the whole page, bestie! this little gem is from perl v5.32.1, dated 2024-08-02 β so go forth, sort your rows, spill to disk responsibly, and remember: stable maybe, iconic definitely. mwah πππΈ
π¦ 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