STRFILE(8)

πŸ“¦
version 0.1 Β· 4 versions
, in alpine 3.24

πŸ’– STRFILE β€” bestie edition πŸ’–

okay so this is the system manager's manual page for strfile(8), and honestly? it's giving β€œtiny utility, big main character energy” πŸ’…. we're gonna keep every detail, no cap.


✨ NAME ✨

strfile, unstr β€” create a random access file for storing strings πŸ¦‹

πŸ¦‹ SYNOPSIS πŸ¦‹

strfile [-iorsx] [-c char] source_file [output_file]
unstr source_file

πŸ’… DESCRIPTION πŸ’…

okay so strfile reads a file containing groups of lines separated by a line containing a single percent % sign, and creates a data file. that data file contains a header structure plus a table of file offsets for each group of lines. the whole point? random access of the strings, periodt ✨.

The output file, if not specified on the command line, is named source_file.dat.

πŸŽ€ the options πŸŽ€

the options are as follows, bestie β€” collect them all:

  • -c char β€” change the delimiting character from the percent sign to char.
  • -i β€” ignore case when ordering the strings.
  • -o β€” order the strings in alphabetical order. the offset table will be sorted in the alphabetical order of the groups of lines referenced. any initial non-alphanumeric characters are ignored. this option causes the STR_ORDERED bit in the header str_flags field to be set.
  • -r β€” randomize access to the strings. entries in the offset table will be randomly ordered. this option causes the STR_RANDOM bit in the header str_flags field to be set.
  • -s β€” run silently; don't give a summary message when finished.
  • -x β€” note that each alphabetic character in the groups of lines is rotated 13 positions in a simple caesar cypher. this option causes the STR_ROTATED bit in the header str_flags field to be set.

🌸 header format 🌸

the format of the header is literally this, bestie:

#define VERSION 2
u_int32_t       str_version;    /* version number */
u_int32_t       str_numstr;     /* # of strings in the file */
u_int32_t       str_longlen;    /* length of longest string */
u_int32_t       str_shortlen;   /* length of shortest string */
#define STR_RANDOM      0x1     /* randomized pointers */
#define STR_ORDERED     0x2     /* ordered pointers */
#define STR_ROTATED     0x4     /* rot-13'd text */
u_int32_t       str_flags;      /* bit field for flags */
u_int8_t        str_delim;      /* delimiting character */
u_int8_t        str_pad[3];     /* padding */

All fields are written in network byte order. Each field is also written independently so as to avoid structure padding problems on some architectures. 🫢

πŸ¦‹ unstr, bestie πŸ¦‹

The purpose of unstr is to undo the work of strfile. It prints out the strings contained in the file source_file in the order that they are listed in the header file source_file.dat to standard output. It is possible to create sorted versions of input files by using -o when strfile is run and then using unstr to dump them out in the table order.

πŸ“ FILES πŸ“

  • source_file.dat β€” default output file.

🌈 SEE ALSO 🌈

πŸ‘‘ HISTORY πŸ‘‘

The strfile utility first appeared in 4.4BSD.


okay bye bestie πŸ’– this page came from Debian, dated August 14, 2013, and it's the STRFILE(8) manual page. slay responsibly ✨🫢

πŸ“¦ where this page comes from
  • alpine 3.24: fortune-doc 0.1-r5 Β· BSD-3-Clause
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms