{"id":15563938,"url":"https://github.com/mrsarm/fq","last_synced_at":"2025-07-20T15:02:37.715Z","repository":{"id":46679352,"uuid":"133186559","full_name":"mrsarm/fq","owner":"mrsarm","description":"Command line tool \"fq\": outputs the frequency table of the input file","archived":false,"fork":false,"pushed_at":"2024-03-20T03:51:19.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-12T12:16:36.403Z","etag":null,"topics":["c-project","cli","cmake","frequency-table"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrsarm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-12T22:02:30.000Z","updated_at":"2021-10-26T15:41:52.000Z","dependencies_parsed_at":"2024-11-18T08:38:14.099Z","dependency_job_id":null,"html_url":"https://github.com/mrsarm/fq","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mrsarm/fq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Ffq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Ffq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Ffq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Ffq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrsarm","download_url":"https://codeload.github.com/mrsarm/fq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsarm%2Ffq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266143941,"owners_count":23883069,"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":["c-project","cli","cmake","frequency-table"],"created_at":"2024-10-02T16:31:41.175Z","updated_at":"2025-07-20T15:02:37.572Z","avatar_url":"https://github.com/mrsarm.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\"Frequency Counter\" project\n===========================\n\nCommand line tool \"fq\": outputs the frequency table of the given input.\n\n    $ fq README.md\t# Counted only the first 20 chars as example\n    \u003e Final frequency table\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'e' 65            3     0\n\t' ' 20            2     1\n\t'\"' 22            2     2\n\t'n' 6E            2     3\n\t'r' 72            2     4\n\t'u' 75            2     5\n\t'C' 43            1     6\n\t'F' 46            1     7\n\t'c' 63            1     8\n\t'o' 6F            1     9\n\t'q' 71            1     A\n\t't' 74            1     B\n\t'y' 79            1     C\n\t-------------------------\n    Size: 20 - Number of symbols: 13\n    \n    $ echo \"Hello world\" | fq\n    \u003e Final frequency table\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'l' 6C            3     0\n\t'o' 6F            2     1\n\t'.' 0A            1     2\n\t' ' 20            1     3\n\t'H' 48            1     4\n\t'd' 64            1     5\n\t'e' 65            1     6\n\t'r' 72            1     7\n\t'w' 77            1     8\n\t-------------------------\n    Size: 12 - Number of symbols: 9\n\nThe symbols are sorted from the highest to the lowest\nfrequencies, and in case two bytes have the same\nfrequency they are sorted \"alphabetically\".\n\n\n### Verbose mode\n\nExecuting it with the `-v` (verbose) argument,\nit iterates the file byte by byte and shows the\nfrequencies each time:\n\n\t$ echo 'banana!!' | fq -v\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            1     0 *\n\t'b' 62            1     1\n\t-------------------------\n\tSize: 2 - Number of symbols: 2\n\t\n\t\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            1     0\n\t'b' 62            1     1\n\t'n' 6E            1     2 *\n\t-------------------------\n\tSize: 3 - Number of symbols: 3\n\t\n\t\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            2     0 \u003c\n\t'b' 62            1     1\n\t'n' 6E            1     2\n\t-------------------------\n\tSize: 4 - Number of symbols: 3\n\t\n\t\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            2     0\n\t'n' 6E            2     1 ^ (+1)\n\t'b' 62            1     2\n\t-------------------------\n\tSize: 5 - Number of symbols: 3\n\t\n\t\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            3     0 \u003c\n\t'n' 6E            2     1\n\t'b' 62            1     2\n\t-------------------------\n\tSize: 6 - Number of symbols: 3\n\t\n\t\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            3     0\n\t'n' 6E            2     1\n\t'!' 21            1     2 *\n\t'b' 62            1     3\n\t-------------------------\n\tSize: 7 - Number of symbols: 4\n\t\n\t\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            3     0\n\t'!' 21            2     1 ^ (+1)\n\t'n' 6E            2     2\n\t'b' 62            1     3\n\t-------------------------\n\tSize: 8 - Number of symbols: 4\n\t\n\t\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            3     0\n\t'!' 21            2     1\n\t'n' 6E            2     2\n\t'.' 0A            1     3 *\n\t'b' 62            1     4\n\t-------------------------\n\tSize: 9 - Number of symbols: 5\n\t\n\t\n\t\u003e Final frequency table\n\tSymbol    Frequency   Pos\n\t-------------------------\n\t'a' 61            3     0\n\t'!' 21            2     1\n\t'n' 6E            2     2\n\t'.' 0A            1     3\n\t'b' 62            1     4\n\t-------------------------\n\tSize: 9 - Number of symbols: 5\n\n\nAnd indicator at the right marks what is the current\nsymbol found, with `*` when the symbol is found for the first\ntime, `\u003c` when isn't the first time and the position in the\ntable didn't change, and `^ (+NUM)` when not the first time\nbut the position in the table has changed _NUM_ positions.\n\n\nBuild and execute\n-----------------\n\nThe project uses *CMakes* to build the executable.\n\n1. From the source directory, generate the \"Makefile\":\n\n       $ cmake .\n\n2. *Make* the project and generate the executable \"fq\".\n\n       $ make\n\n3. Then execute with (use with `-h` to see available options):\n\n       $ out/fq\n\n4. To install the executable `fq` into `/usr/local/bin`:\n\n       $ sudo make install\n\n   To install into another folder, when executing the step 1\n   overwrite the `CMAKE_INSTALL_PREFIX` variable, eg.\n   to install into the `/usr/bin` folder:\n\n       $ cmake -DCMAKE_INSTALL_PREFIX=/usr .\n\nTo clean the compiled binaries and compiled modules:\n\n    $ make clean\n\nTo clean all the compiled binaries and the \"Makefiles\" files:\n\n    $ make clean-all\n\n\n### Tests\n\nTests are built with CHEAT \u003chttps://github.com/Tuplanolla/cheat\u003e,\na unit testing framework for C/C++, and can be executed\nwith CMake CTest:\n\n    $ make test\n\nTo run the tests and see all the output in the console (specially\nif the tests fail), first build the project (`make`) and then execute:\n\n    $ out/test_fq\n\n\nAbout\n-----\n\nSource: https://github.com/mrsarm/fq\n\nAuthors: (2015-2024) Mariano Ruiz \u003cmrsarm@gmail.cm\u003e\n\nLicense: LGPL-3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsarm%2Ffq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrsarm%2Ffq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrsarm%2Ffq/lists"}