{"id":22837381,"url":"https://github.com/hubtou/strfile","last_synced_at":"2026-05-02T19:36:21.892Z","repository":{"id":57453837,"uuid":"390818191","full_name":"HubTou/strfile","owner":"HubTou","description":"Create a random access file for storing strings","archived":false,"fork":false,"pushed_at":"2021-09-26T16:23:37.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T23:45:46.939Z","etag":null,"topics":["command-line-tool","fortune-files","fortune-format","learning-python","learning-unix","pnu-project","python","quotes-application","shell","tools","unix","unix-command","utility"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HubTou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-29T18:35:41.000Z","updated_at":"2023-06-02T20:41:22.000Z","dependencies_parsed_at":"2022-08-29T06:51:41.782Z","dependency_job_id":null,"html_url":"https://github.com/HubTou/strfile","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Fstrfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Fstrfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Fstrfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubTou%2Fstrfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HubTou","download_url":"https://codeload.github.com/HubTou/strfile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246412730,"owners_count":20773050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","fortune-files","fortune-format","learning-python","learning-unix","pnu-project","python","quotes-application","shell","tools","unix","unix-command","utility"],"created_at":"2024-12-12T23:16:37.024Z","updated_at":"2026-05-02T19:36:21.861Z","avatar_url":"https://github.com/HubTou.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Installation\npip install [pnu-strfile](https://pypi.org/project/pnu-strfile/)\n\n# STRFILE(8), UNSTR(8)\n\n## NAME\nstrfile, unstr — create a random access file for storing strings\n\n## SYNOPSIS\n**strfile**\n\\[-Ciorsx\\]\n\\[-c char\\]\n\\[--debug\\]\n\\[--help|-?\\]\n\\[--version\\]\n\\[--\\]\nsource_file \\[output_file\\]\n\n**unstr**\n\\[--debug\\]\n\\[--help|-?\\]\n\\[--version\\]\n\\[--\\]\nsource_file\n\n## DESCRIPTION\nThe **strfile** utility reads a file containing groups of lines separated by a line containing a single percent ‘%’ sign and creates a data file which contains a header structure and a table of file offsets for each group of lines.\nThis allows random access of the strings.\n\nThe output file, if not specified on the command line, is named *source_file.dat*.\n\nThe options are as follows:\n\nOptions | Use\n------- | ---\n-C|Flag the file as containing comments. This option cases the STR_COMMENTS bit in the header str_flags field to be set. Comments are designated by two delimiter characters at the beginning of the line, though strfile does not give any special treatment to comment lines.\n-c char|Change the delimiting character from the percent sign to char.\n-i|Ignore case when ordering the strings.\n-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.\n-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. The *-o* option has precedence over the *-r* option.\n-s|Run silently; do not give a summary message when finished.\n-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.\n--debug|Enable debug mode\n--help\\|-?|Print usage and a short help message and exit\n--version|Print version and exit\n--|Options processing terminator\n\nThe format of the header is:\n\n```C\n#define VERSION 1\nuint32_t        str_version;    /* version number */\nuint32_t        str_numstr;     /* # of strings in the file */\nuint32_t        str_longlen;    /* length of longest string */\nuint32_t        str_shortlen;   /* length of shortest string */\n#define STR_RANDOM      0x1     /* randomized pointers */\n#define STR_ORDERED     0x2     /* ordered pointers */\n#define STR_ROTATED     0x4     /* rot-13'd text */\n#define STR_COMMENTS    0x8     /* embedded comments */\nuint32_t        str_flags;      /* bit field for flags */\nchar            str_delim;      /* delimiting character */\n```\n\nAll fields are written in network byte order.\n\nThe purpose of **unstr** is to undo the work of **strfile**.\nIt 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.\nIt 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.\n\n## ENVIRONMENT\nThe STRFILE_DEBUG and UNSTR_DEBUG environment variables can also be set to any value to enable debug mode.\n\n## SEE ALSO\n[byteorder(3)](https://www.freebsd.org/cgi/man.cgi?query=byteorder),\n[fortune(6)](https://github.com/HubTou/fortune/blob/main/README.md)\n\n## STANDARDS\nThis re-implementation is fully compatible with the FreeBSD version.\n\nIt tries to follow the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide for [Python](https://www.python.org/) code.\n\n## HISTORY\nContributed by [Ken Arnold](https://en.wikipedia.org/wiki/Ken_Arnold), the **strfile** utility first appeared in 4.1cBSD.\n\nThis re-implementation was made for [The PNU project](https://github.com/HubTou/PNU).\n\n## LICENSE\nThis version is available under the [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause).\n\n## AUTHORS\nThis version was written by [Hubert Tournier](https://github.com/HubTou).\n\nThe man page is derived from the [FreeBSD project's one](https://www.freebsd.org/cgi/man.cgi?query=strfile).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubtou%2Fstrfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubtou%2Fstrfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubtou%2Fstrfile/lists"}