XMLSORT(1)
π NAME π
okay so this is the XMLSORT(1) manual page, bestie β from User Contributed Perl Documentation β and it does exactly one iconic thing: sorts 'records' in XML files. no cap.
β¨ SYNOPSIS β¨
xmlsort -r=<recordname> [ <other options> ] [ <filename> ]
Options:
-r <name> name of the elements to be sorted
-k <keys> child nodes to be used as sort keys
-i ignore case when sorting
-s normalise whitespace when comparing sort keys
-t <dir> buffer records to named directory rather than in memory
-m <bytes> set memory chunk size for disk buffering
-h help - display the full documentation
Example:
xmlsort -r 'person' -k 'lastname;firstname' -i -s in.xml >out.xml
πΈ DESCRIPTION πΈ
So basically this script takes an XML document either on STDIN or from a named file, and writes a sorted version of the file to STDOUT. The -r option is the one you use to identify the 'records' in the document β like, the actual bits you want sorted. Elements before and after those records will be unaffected by the sort. periodt. π
π OPTIONS π
Here's the brief lil summary of the command line options (and the XML::Filter::Sort options they correspond to). For more details, see XML::Filter::Sort. π«Ά
-r <recordname>(Record) β the name of the elements to be sorted. This can be a simple element name like'person'or a pathname like'employees/person'(which means only person elements contained directly within an employees element).-k <keys>(Keys) β semicolon separated list of elements (or attributes) within a record that should be used as sort keys. Each key can optionally be followed by'alpha'or'num'to indicate alphanumeric or numeric sorting, and'asc'or'desc'for ascending or descending order (e.g.-k 'lastname;firstname;age,n,d').-i(IgnoreCase) β this option makes sort comparisons case insensitive.-s(NormaliseKeySpace) β by default all whitespace in the sort key elements is considered significant. Specifying-swill cause leading and trailing whitespace to be stripped and internal whitespace runs to be collapsed to a single space.-t <directory>(TempDir) β when sorting large documents, it may be prudent to use disk buffering rather than memory buffering. This option lets you specify where temporary files should be written.-m <bytes>(MaxMem) β if you use the-toption to enable disk buffering, records will be collected in memory in 'chunks' of up to about 10 megabytes before being sorted and spooled to temporary files. This option lets you specify a larger chunk size. A suffix ofKorMindicates kilobytes or megabytes respectively.-hβ help; displays the full documentation.
π¦ SEE ALSO π¦
This script uses the following modules:
XML::SAX::ParserFactory
XML::Filter::Sort
XML::SAX::Writer
π AUTHOR π
Grant McLean <grantm@cpan.org>
π COPYRIGHT π
Copyright (c) 2002 Grant McLean. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay bestie, that's the whole manual β source/version is perl v5.42.3, dated 2005-04-20. slay and goodbye π
β¨
π¦ where this page comes from
- nixos 26.05: perl5.42.3-XML-Filter-Sort 1.01
- nixpkgs unstable: perl5.42.3-XML-Filter-Sort 1.01
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms