STRFILE(8)
π 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 theSTR_COMMENTSbit in the headerstr_flagsfield. comments are designated by two delimiter characters at the beginning of the line, thoughstrfiledoes not give any special treatment to comment lines. heads up, bestie π«Ά-cchar β 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 theSTR_ORDEREDbit in the headerstr_flagsfield to be set.-rβ randomize access to the strings. entries in the offset table will be randomly ordered. this option causes theSTR_RANDOMbit in the headerstr_flagsfield 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 theSTR_ROTATEDbit in the headerstr_flagsfield 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
- Copyright (c) 1989, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms