STRFILE(8)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’– NAME πŸ’–

okay so this is the STRFILE(8) page from the System Manager's Manual, bestie β€” and the stars are strfile and unstr. Their whole thing? create a random access file for storing strings. slay.


✨ SYNOPSIS ✨

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

🌸 DESCRIPTION 🌸

okay so strfile reads a file that contains groups of lines separated by a line containing a single percent % sign, and then it creates a data file πŸ’…. that data file contains a header structure and a table of file offsets for each group of lines. this is what allows random access of the strings. iconic behavior, honestly.

the output file, if you don't specify it on the command line, is named source_file.dat. no cap.

✨ OPTIONS ✨

the option menu is giving choose-your-fighter, and here's every single one:

  • -C β€” flag the file as containing comments. this option sets the STR_COMMENTS bit in the header str_flags field. comments are designated by two delimiter characters at the beginning of the line, though strfile does not give any special treatment to comment lines. heads up, bestie 🫢
  • -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; do not give a summary message when finished. quiet queen energy.
  • -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.

🧬 the header format 🧬

the format of the header is:

#define VERSION 1
uint32_t        str_version;    /* version number */
uint32_t        str_numstr;     /* # of strings in the file */
uint32_t        str_longlen;    /* length of longest string */
uint32_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 */
#define STR_COMMENTS    0x8     /* embedded comments */
uint32_t        str_flags;      /* bit field for flags */
char            str_delim;      /* delimiting character */

all fields are written in network byte order. periodt.


and now for unstr, the undo button 😌. 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. cute, useful, we love to see it πŸ’–


πŸŽ€ FILES πŸŽ€

  • strfile.dat β€” default output file.

πŸ¦‹ SEE ALSO πŸ¦‹


πŸ‘‘ HISTORY πŸ‘‘

the strfile utility first appeared in 4.4BSD. a legend was born, lowkey.


xoxo, bestie πŸ’‹ β€” this page is from Debian, dated February 17, 2005. mwah πŸ’–

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms