{"id":16935408,"url":"https://github.com/knu/inplace","last_synced_at":"2025-04-11T18:53:50.743Z","repository":{"id":2637655,"uuid":"3626554","full_name":"knu/inplace","owner":"knu","description":"A command line utility that edits files in-place through given filter commands","archived":false,"fork":false,"pushed_at":"2023-06-04T20:42:30.000Z","size":66,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T14:51:17.223Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knu.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,"governance":null}},"created_at":"2012-03-05T11:53:48.000Z","updated_at":"2023-06-04T20:42:31.000Z","dependencies_parsed_at":"2023-07-05T20:31:31.149Z","dependency_job_id":null,"html_url":"https://github.com/knu/inplace","commit_stats":{"total_commits":82,"total_committers":1,"mean_commits":82.0,"dds":0.0,"last_synced_commit":"94700a3237abc40ca1629547bb6925e64aa8dbe2"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Finplace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Finplace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Finplace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knu%2Finplace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knu","download_url":"https://codeload.github.com/knu/inplace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312057,"owners_count":21082635,"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":[],"created_at":"2024-10-13T20:54:28.692Z","updated_at":"2025-04-11T18:53:50.720Z","avatar_url":"https://github.com/knu.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"INPLACE(1)\n==========\n\n## NAME\n\ninplace -- edits files in-place through given filter commands\n\n## SYNOPSIS\n\n```\ninplace [-DLfinstvz] [-b SUFFIX]\n        [[-e] \"COMMANDLINE\"] [-E COMMAND ... --] [file ...]\n```\n\n## DESCRIPTION\n\nThe inplace command is a utility to edit files in-place through given\nfilter commands preserving the original file attributes.  Mode and\nownership (user and group) are preserved by default, and time (access\nand modification) by choice.\n\nInode numbers will change by default, but there is a `-i` option with\nwhich given the inode number of each edited file will be preserved.\n\nAs for filter commands, a single command may be specified as the first\nargument to inplace.  To pass many filter commands, use `-e` or `-E`\noption.\n\nThere are some cases where inplace does not replace a file, such as\nwhen:\n\n1.  The original file is not writable (use `-f` to force editing\n    against read-only files)\n\n2.  A filter command fails and exits with a non-zero return code\n\n3.  The resulted output is identical to the original file\n\n4.  The resulted output is empty (use `-z` to accept empty output)\n\n## OPTIONS\n\nThe following command line arguments are supported:\n\n*   `-h`\n*   `--help`\n\n    Show help and exit.\n\n*   `-D`\n*   `--debug`\n\n    Turn on debug output.\n\n*   `-L`\n*   `--dereference`\n\n    By default, inplace ignores non-regular files including symlinks,\n    but this switch makes it resolve (dereference) each symlink using\n    `realpath(3)` and edit the original file.\n\n*   `-b SUFFIX`\n*   `--backup-suffix SUFFIX`\n\n    Create a backup file with the given suffix for each file.  Note\n    that backup files will be written over existing files, if any.\n\n*   `-e COMMANDLINE`\n*   `--execute COMMANDLINE`\n*   `-E COMMAND ... --` / `-E\u003cTERM\u003e COMMAND ... \u003cTERM\u003e`\n*   `--execute-args COMMAND ... --` / `--execute-args=\u003cTERM\u003e COMMAND ... \u003cTERM\u003e`\n\n    Specify a filter command line to run for each file in which the\n    following placeholders can be used:\n\n    *   `%0`\n\n        replaced by the original file path, shell escaped with `\\`'s\n        as necessary\n\n    *   `%1`\n\n        replaced by the source file path, shell escaped with `\\`'s as\n        necessary\n\n    *   `%2`\n\n        replaced by the destination file path, shell escaped with\n        `\\`'s as necessary\n\n    *   `%%`\n\n        replaced by `%`\n\n    Omission of `%2` indicates `%1` should be modified destructively,\n    and omission of both `%1` and `%2` implies `(...) \u003c %1 \u003e %2`\n    around the command line.\n\n    When the filter command is run, the destination file is always an\n    empty temporary file, and the source file is either the original\n    file or a temporary copy file.\n\n    Every temporary file has the same suffix as the original file, so\n    that file name aware programs can play nicely with it.\n\n    Instead of specifying a whole command line, you can use a command\n    alias defined in a configuration file, `~/.config/inplace/config`\n    or `~/.inplace`.  See the FILES section for the file format.\n\n    This option can be specified many times, and they will be executed\n    in sequence.  A file is only replaced if all of them succeeds.\n\n    See the EXAMPLES section below for details.\n\n*   `-f`\n*   `--force`\n\n    By default, inplace does not perform editing if a file is not\n    writable.  This switch makes it force editing even if a file to\n    process is read-only.\n\n*   `-i`\n*   `--preserve-inode`\n\n    Make sure to preserve the inode number of each file.\n\n*   `-n`\n*   `--dry-run`\n\n    Do not perform any destructive operation and just show what would\n    have been done.  This switch implies `-v`.\n\n*   `-s`\n*   `--same-directory`\n\n    Create a temporary file in the same directory as each replaced\n    file.  This may speed up the performance when the directory in\n    question is on a partition that is fast enough and the system\n    temporary directory is slow.\n\n    This switch can be effectively used when the temporary directory\n    does not have sufficient disk space for a resulted file.\n\n    If this option is specified, edited files will have newly assigned\n    inode numbers.  To prevent this, use the `-i` option.\n\n*   `-t`\n*   `--preserve-timestamp`\n\n    Preserve the access and modification times of each file.\n\n*   `-v`\n*   `--verbose`\n\n    Turn on verbose mode.\n\n*   `-z`\n*   `--accept-empty`\n\n    By default, inplace does not replace the original file when a\n    resulted file is empty in size because it is likely that there is\n    a mistake in the filter command.  This switch makes it accept\n    empty (zero-sized) output and replace the original file with it.\n\n## EXAMPLES\n\n*   Sort files in-place using sort(1):\n\n        inplace sort file1 file2 file3\n\n    Below works the same as above, passing each input file via the\n    command line argument:\n\n        inplace 'sort %1 \u003e %2' file1 file2 file3\n\n*   Perform in-place charset conversion and newline code conversion:\n\n        inplace -E iconv -f EUC-JP -t UTF-8 -- -E perl -pe 's/$/\\r/' -- file1 file2 file3\n\n*   Process image files taking backup files:\n\n        inplace -b.orig -E convert -rotate 270 -resize 50%% %1 %2 -- *.jpg\n\n*   Perform a mass MP3 tag modification without changing timestamps:\n\n        find mp3/Some_Artist -name '*.mp3' -print0 | \\\n          xargs -0 inplace -tE mp3info -a \"Some Artist\" -g \"Progressive Rock\" %1 --\n\n    As you see above, inplace makes a nice combo with find(1) and\n    `xargs(1)`.\n\n## FILES\n\n*   `~/.config/inplace/config` or `~/.inplace`\n\n    The configuration file, which syntax is described as follows:\n\n    *   Each alias definition is a name/value pair separated with an\n        `=`, one per line.\n\n    *   White spaces at the beginning or the end of a line, and around\n        assignment separators (`=`) are stripped off.\n\n    *   Lines starting with a `#` are ignored.\n\n## ENVIRONMENT\n\n*   `TMPDIR`\n*   `TMP`\n*   `TEMP`\n\n    Temporary directory candidates where inplace attempts to create\n    intermediate output files, in that order.  If none is available\n    and writable, `/tmp` is used.  If `-s` is specified, they will not\n    be used.\n\n## HOW TO INSTALL\n\nJust copy `lib/inplace.rb` to `/somewhere/in/your/path/inplace`, or:\n\n        gem install inplace\n\n## SEE ALSO\n\n[`find(1)`](http://www.freebsd.org/cgi/man.cgi?query=find\u0026sektion=1),\n[`xargs(1)`](http://www.freebsd.org/cgi/man.cgi?query=xargs\u0026sektion=1),\n[`realpath(3)`](http://www.freebsd.org/cgi/man.cgi?query=realpath\u0026sektion=3)\n\n## HISTORY\n\nThe inplace utility was first released on 2 May, 2004.\n\nThis utility was written when the author did not feel very happy with\nthe `-i` option added to `sed(1)` on FreeBSD.\n\n## AUTHORS\n\nAkinori MUSHA \u003cknu@iDaemons.org\u003e\n\nLicensed under the 2-clause BSD license.  See `LICENSE` for details.\n\nVisit [the GitHub repository](https://github.com/knu/inplace) for the\nlatest information and feedback.\n\n## BUGS\n\nThere may always be some bugs.  Use at your own risk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknu%2Finplace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknu%2Finplace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknu%2Finplace/lists"}