{"id":18841094,"url":"https://github.com/x1ao4/line-indexer","last_synced_at":"2025-06-13T16:06:41.068Z","repository":{"id":179174227,"uuid":"663077242","full_name":"x1ao4/line-indexer","owner":"x1ao4","description":"通过 python 脚本为 txt 文档的每一行添加索引号 / add line numbers to txt file via python script","archived":false,"fork":false,"pushed_at":"2023-07-11T07:41:27.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T09:49:05.491Z","etag":null,"topics":["index","index-number","line-index","line-number","txt-editor","txt-sorting"],"latest_commit_sha":null,"homepage":"","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/x1ao4.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":"2023-07-06T13:58:05.000Z","updated_at":"2023-07-18T09:35:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c2ce221-5abb-404e-baab-6661cd80b59a","html_url":"https://github.com/x1ao4/line-indexer","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":0.2222222222222222,"last_synced_commit":"c80b8fa8e186ba1e4f84848aebe097a399f478e1"},"previous_names":["x1ao4/line-indexer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x1ao4%2Fline-indexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x1ao4%2Fline-indexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x1ao4%2Fline-indexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x1ao4%2Fline-indexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x1ao4","download_url":"https://codeload.github.com/x1ao4/line-indexer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239780121,"owners_count":19695734,"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":["index","index-number","line-index","line-number","txt-editor","txt-sorting"],"created_at":"2024-11-08T02:50:02.558Z","updated_at":"2025-02-20T04:41:07.769Z","avatar_url":"https://github.com/x1ao4.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# line-indexer\n使用 line-indexer 可以为你的文本自动逐行添加索引号。\n\n## 功能演示\n假设 `input.txt` 文件中的内容如下：\n```\napple\nbanana\ncherry\n```\n运行脚本后，`output.txt` 文件中的内容将变为：\n```\n1;apple\n2;banana\n3;cherry\n```\n每一行前面都添加了一个索引号，用 `;` 与原来的内容分隔。\n\n## 运行条件\n请确保您的系统上安装了 Python 3.6 或更高版本。\n\n## 使用方法\n1. 将仓库克隆或下载到计算机上的一个目录中。\n2. 修改 `start.command (Mac)` 或 `start.bat (Win)` 中的路径，以指向您存放 `line-indexer.py` 脚本的目录。\n3. 将要处理的文本保存为 `input.txt` 文件，并放在与脚本相同的目录中。\n4. 双击运行 `start.command` 或 `start.bat` 脚本以执行 `line-indexer.py` 脚本。\n5. 结果将写入到同一目录下名为 `output.txt` 的文件中。\n\n您也可以通过编辑 `line-indexer.py` 脚本中 `{i};{line}` 的部分来自定义分隔符，将 `;` 替换为您想要的分隔符即可。\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n# line-indexer\nWith line-indexer, you can automatically add line numbers to your text file.\n\n## Demo\nAssuming the contents of the `input.txt` file are as follows:\n```\napple\nbanana\ncherry\n```\nAfter running the script, the content of the `output.txt` file will be:\n```\n1;apple\n2;banana\n3;cherry\n```\nA line index number is added before each line, separated by a `;` from the original content.\n\n## Requirements\nMake sure you have Python 3.6 or higher installed on your system.\n\n## Usage\n1. Clone or download the repository to a directory on your computer.\n2. Modify the path in `start.command (Mac)` or `start.bat (Win)` to point to the directory where you store the `line-indexer.py` script.\n3. Save the text to be processed as an `input.txt` file and place it in the same directory as the script.\n4. Double-click `start.command` or `start.bat` to execute the `line-indexer.py` script.\n5. The result will be written to a file named `output.txt` in the same directory.\n\nYou can also customize the separator by editing the `{i};{line}` part in the `line-indexer.py` script. Simply replace `;` with your desired separator.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx1ao4%2Fline-indexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx1ao4%2Fline-indexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx1ao4%2Fline-indexer/lists"}