{"id":15009030,"url":"https://github.com/wroberts/fsed","last_synced_at":"2025-04-09T16:23:09.037Z","repository":{"id":57432390,"uuid":"47888948","full_name":"wroberts/fsed","owner":"wroberts","description":"Aho-Corasick string replacement utility","archived":false,"fork":false,"pushed_at":"2019-11-25T17:28:39.000Z","size":515,"stargazers_count":24,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T18:38:56.846Z","etag":null,"topics":["aho-corasick","python","python-2","python-3","replace-text","rewrite-system","string-matching","text-search"],"latest_commit_sha":null,"homepage":null,"language":"sed","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wroberts.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.rst","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-12T18:09:47.000Z","updated_at":"2024-12-13T07:04:54.000Z","dependencies_parsed_at":"2022-09-19T08:02:22.575Z","dependency_job_id":null,"html_url":"https://github.com/wroberts/fsed","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Ffsed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Ffsed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Ffsed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroberts%2Ffsed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wroberts","download_url":"https://codeload.github.com/wroberts/fsed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247926506,"owners_count":21019501,"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":["aho-corasick","python","python-2","python-3","replace-text","rewrite-system","string-matching","text-search"],"created_at":"2024-09-24T19:22:30.904Z","updated_at":"2025-04-09T16:23:08.904Z","avatar_url":"https://github.com/wroberts.png","language":"sed","funding_links":[],"categories":[],"sub_categories":[],"readme":"================================================\n fsed - Aho-Corasick string replacement utility\n================================================\n\n.. image:: https://travis-ci.org/wroberts/fsed.svg?branch=master\n    :target: https://travis-ci.org/wroberts/fsed\n    :alt: Travis CI build status\n\n.. image:: https://coveralls.io/repos/wroberts/fsed/badge.svg?branch=master\u0026service=github\n    :target: https://coveralls.io/github/wroberts/fsed?branch=master\n    :alt: Test code coverage\n\n.. image:: https://img.shields.io/pypi/v/fsed.svg\n    :target: https://pypi.python.org/pypi/fsed/\n    :alt: Latest Version\n\nCopyright (c) 2015 Will Roberts \u003cwildwilhelm@gmail.com\u003e\n\nLicensed under the MIT License (see file ``LICENSE.rst`` for\ndetails).\n\nSearch and replace on file(s), with matching on fixed strings.\n\n``fsed`` is a tool specially designed for situations where you have to\ndo *many* string search-and-replace operations with fixed strings\n(that is, ``fsed`` doesn't do regular expressions).  By doing all the\nsearching and replacing on all the patterns at the same time, ``fsed``\ncan be much faster than tools that do string rewriting one pattern at\na time (like one-liners in ``sed`` or ``perl``).\n\nTo do its searching, ``fsed`` uses the `Aho-Corasick algorithm`_,\nwhich is a very clever way of matching multiple patterns at the same\ntime, and was used to implement the original `fgrep`_ Unix utility\n(now accessed as ``grep -F``).  This algorithm is capable of finding\nmatches which overlap each other, and in these cases, ``fsed`` must\nchoose which matches to rewrite.  The policy adopted by ``fsed`` is to\nbe greedy, and always rewrite the shortest, leftmost match first.\n\nFor illustration, imagine a situation where we would like to rewrite\n``a`` with ``b``, ``aa`` with ``c``, and ``aaa`` with ``d``.  What\nshould we do when we see the input string ``aaa``?  Should we produce\n``bbb``, ``bc``, ``cb``, or ``d``?  ``fsed`` produces ``bbb`` in this\ncase.\n\n.. _`Aho-Corasick algorithm`: https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm\n.. _fgrep: https://en.wikipedia.org/wiki/Grep#Variations\n\nInstall\n=======\n\n``fsed`` is written in Python_; you can install it with pip_::\n\n    pip install fsed\n\n.. _Python: http://www.python.org/\n.. _pip: https://en.wikipedia.org/wiki/Pip_(package_manager)\n\nUsage\n=====\n\n::\n\n    fsed [OPTIONS] PATTERN_FILE [INPUT_FILE [INPUT_FILE2 ...]]\n\nIf one or more ``INPUT_FILEs`` are specified, ``fsed`` reads and\nconcatenates these as its input; otherwise, ``fsed`` reads the\nstandard input.\n\nOptions:\n\n``--pattern-format=FMT``\n    Set FMT to ``tsv`` or ``sed`` (default is ``sed``) to specify the\n    format of ``PATTERN_FILE``.\n\n``-o/--output=OUTFILE``\n    Specifies that the program output should be written to ``OUTFILE``.\n    If this option is not used, ``fsed`` writes to standard output.\n\n``-w/--words``\n    Makes ``fsed`` match only on word boundaries; this flag instructs\n    ``fsed`` to append ``\\b`` to the beginning and end of every\n    pattern in ``PATTERN_FILE``.\n\n``--by-line/--across-lines``\n    Sets whether ``fsed`` should process the input line by line\n    or character by character; the default is ``--across-lines``.\n\n``--slow``\n    Indicates that ``fsed`` should try very hard to always find the\n    longest matches on the input; this is very slow, and forces\n    ``--by-line`` to be on.\n\n``-q``\n    Quiet operation, do not emit warnings.\n\n``-v/--verbose``\n    Turns on debugging output.\n\nNote: ``fsed`` runs even faster using PyPy_::\n\n    pypy -m fsed.fsed [OPTIONS] PATTERN_FILE [INPUT_FILE [INPUT_FILE2 ...]]\n\n.. _PyPy: http://pypy.org/\n\nPattern File\n============\n\n``PATTERN_FILE`` contains a list of patterns to search and replace in\nthe input; each pattern is listed on a separate line.  ``fsed``\nsupports two formats for specifying patterns.  The default, ``sed``,\nspecifies strings and their replacements the way the ``sed`` utility\ndoes::\n\n    s/SEARCH/REPLACE/\n\nThe character following the ``s`` character is the pattern delimiter,\nand can be any character (it does not have to be a forward slash).\n\nThe other format, ``tsv``, specifies patterns using ``\u003cTAB\u003e``\ncharacters as delimiters::\n\n    SEARCH\u003cTAB\u003eREPLACE\n\nIn this format, there must be only one ``\u003cTAB\u003e`` character per line.\n\nPatterns can contain escape characters:\n\n``\\\\``\n    Backslash (\\\\)\n\n``\\a``\n    ASCII bell (BEL)\n\n``\\b``\n    Word boundary\n\n``\\f``\n    ASCII formfeed (FF)\n\n``\\n``\n    ASCII linefeed (LF)\n\n``\\r``\n    Carriage Return (CR)\n\n``\\t``\n    Horizontal Tab (TAB)\n\n``\\v``\n    ASCII vertical tab (VT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwroberts%2Ffsed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwroberts%2Ffsed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwroberts%2Ffsed/lists"}