STAG-SPLITTER(1)

๐Ÿ“ฆ
version 0.14 ยท 3 versions
, in fedora 43

๐Ÿ’– STAG-SPLITTER(1) ๐Ÿ’–

okay bestie, welcome to stag-splitter, a lil script from the User Contributed Perl Documentation corner of the universe. she splits a stag file into multiple files and honestly? she's iconic for it. let's get into it ๐Ÿฆ‹


โœจ NAME โœจ

stag-splitter โ€” splits a stag file into multiple files. that's it, that's the whole job, and she does it flawlessly ๐Ÿ’…


โœจ SYNOPSIS โœจ

stag-splitter -split person -name social_security_no file.xml

like. one line. boom. files. periodt ๐Ÿ‘‘


โœจ DESCRIPTION โœจ

so here's the vibe: this thing splits a file using a user specified parser (default is xml, no cap) around a specified split node, and it names each file according to the name argument.

the files will be named anonymously unless the -name switch is specified โ€” in which case it uses the value of the specified element as the filename. cute, right? ๐ŸŽ€

eg; if we have

<top>
  <a>
    <b>foo</b>
    <c>yah</c>
    <d>
      <e>xxx</e>
    </d>
  </a>
  <a>
    <b>bar</b>
    <d>
      <e>wibble</e>
    </d>
  </a>
</top>

if we run

stag-splitter -split a -name b

it will generate two files, "foo.xml" and "bar.xml". not me crying over how clean that is ๐Ÿ˜ญโœจ

input format can be 'xml', 'sxpr' or 'itext' โ€” and if this is left blank, the format will be guessed from the file suffix. she's psychic like that ๐Ÿ”ฎ

the output format defaults to the same as the input format, but another can be chosen. your split, your rules ๐Ÿ’โ™€๏ธ

files go in the current directory, but this can be overridden with the '-dir' switch. yes bestie, you CAN put them somewhere else ๐ŸŒธ


โœจ USAGE โœจ

stag-splitter [-split <ELEMENT-NAME>] [-name <ELEMENT-NAME>] [-dir <DIR>] [-format <INPUT-FORMAT>] [-outformat <OUTPUT-FORMAT>] <FILENAMES>

๐ŸŒˆ OPTIONS ๐ŸŒˆ

  • -p|parser FORMAT โ€” FORMAT is one of xml, sxpr or itext, or the name of a perl module. xml is assumed as default ๐Ÿฃ
  • -w|writer FORMAT โ€” FORMAT is one of xml, sxpr or itext, or the name of a perl module. (yes, you can hand her a whole module name, she's flexible like that ๐Ÿ’œ)
  • -split|s NODE โ€” the node to split on. this is the main character of the whole operation ๐Ÿ‘‘
  • -name|n NODE โ€” the field/element to use when naming files. if you don't specify this argument, she'll use surrogate IDs instead ๐Ÿ“
  • -name|n NODE โ€” hmm wait no bestie, scroll up, we already covered that one ๐Ÿ™ˆ the actual last one is:
  • -dir|d DIR โ€” write files to this directory. go forth and organize ๐Ÿ“โœจ
lowkey important: if -name isn't specified, the filenames come from surrogate IDs. so if your files look weird and anonymous, that's why, and it's not a bug, it's just the default vibe ๐Ÿ’€

that's the whole page, bestie!! ๐Ÿซถ go split some files, you absolute legend. slay ๐Ÿ’–


with love, this page came from perl v5.42.0 and is dated 2025-07-25. mwah ๐Ÿ˜˜ ๐ŸŒธ๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from