{"id":15471442,"url":"https://github.com/aisk/awpie","last_synced_at":"2025-03-23T05:42:28.583Z","repository":{"id":221547363,"uuid":"754686267","full_name":"aisk/awpie","owner":"aisk","description":"Using Python as awk alternative","archived":false,"fork":false,"pushed_at":"2024-03-09T15:58:06.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T12:22:57.287Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/aisk.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,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-08T15:19:33.000Z","updated_at":"2024-02-24T09:56:59.000Z","dependencies_parsed_at":"2024-02-08T17:07:28.856Z","dependency_job_id":"9e42e6c9-135b-460f-a0dc-9be8346e8e4c","html_url":"https://github.com/aisk/awpie","commit_stats":null,"previous_names":["aisk/awpie"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fawpie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fawpie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fawpie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aisk%2Fawpie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aisk","download_url":"https://codeload.github.com/aisk/awpie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245061384,"owners_count":20554563,"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-02T02:19:55.497Z","updated_at":"2025-03-23T05:42:28.564Z","avatar_url":"https://github.com/aisk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# awpie\n\n![logo](https://i.ytimg.com/vi/M1Xlo4fLlJs/maxresdefault.jpg)\n\nUsing Python as awk alternative.\n\n## Installation\n\n```sh\n$ pip install awpie\n```\n\n## Usage\n\nUpper case all inputs:\n\n```sh\n$ printf 'apple\\norange\\n' | awpie 'print(line.upper())'\nAPPLE\nORANGE\n```\n\nChange orange to banana:\n\n```sh\n$ printf 'apple\\norange\\n' | awpie 'print(line) if line != \"orange\" else print(\"banana\")'\napple\nbanana\n```\n\n## Command Line Options\n\n```sh\n$ awpie\nUsage: awpie [--sep=separator] [--imports=module1,module2] [--begin='prog'] [--end='prog'] 'prog' [file ...]\n```\n\n### `sep`\n\nSeparator used to split a line, default value is blank.\n\n### `imports`\n\nSpecify which modules will be imported before executing all codes. Can specify multiple modules like `--imports=csv,tomlib`.\n\nThese modules are imported by default:\n\n- collections\n- fileinput\n- functools\n- getopt\n- importlib\n- itertools\n- operator\n- os\n- sys\n\n### `begin`\n\nCodes that will be executed before processing all files.\n\n### `end`\n\nCodes that will be executed after processing all files.\n\n### `prog`\n\nCodes that will be executed for every line.\n\n### `file`\n\nFile to process. Default is to read a stream from `stdin` as the file.\n\n## Local variables\n\n| Name          | Type        | Description                                                            |\n| ------------- |------------ | ---------------------------------------------------------------------- |\n| `line`        | `str`       | Current line.                                                          |\n| `fields`      | `list[str]` | Result of `line.split(sep)`. `sep` can be specified in arguments.      |\n| `data`        | `dict`      | An empty dict, can be used to store custom values.                     |\n| `stdout`      |             | `sys.stdout`.                                                          |\n| `stderr`      |             | `sys.stderr`.                                                          |\n| `filename`    | `str`       | Name of the file currently being read.                                 |\n| `fileno`      | `int`       | File descriptor for the current file.                                  |\n| `lineno`      | `int`       | Cumulative line number of the line that has just been read.            |\n| `filelineno`  | `int`       | Line number in the current file.                                       |\n| `isfirstline` | `bool`      | Whether the line just read is the first line of its file or not.       |\n| `isstdin`     | `bool`      | Whether the last line was read from sys.stdin or not.                  |\n| `nextfile`    | `callable`  | Close current file so that next iteration will be read from next file. |\n| `close`       | `callable`  | Close the sequence.                                                    |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Fawpie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faisk%2Fawpie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faisk%2Fawpie/lists"}