{ "info": { "author": "hideshi", "author_email": "hideshi.ogoshi@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Application Frameworks" ], "description": "All you have to do is make a script file and create a class which extends PyAwk class and write some procedures like awk. \r\n\r\nThere are some examples on https://github.com/hideshi/PyAwk. \r\n\r\nRequirements\r\n------------\r\n* Python 3.3 or later\r\n\r\nFeatures\r\n--------\r\n* begin and end syntax which are called only once in an execution.\r\n* begin_file and end_file syntax which are called only once par each file.\r\n* awk specific valiables like FILENAME, FS, OFS, RS, ORS, NF, NR, FNR, FIELDWIDTHS.\r\n* command line options like debug mode, set valiables.\r\n* SQLite3 query.\r\n\r\nSetup\r\n-----\r\n::\r\n\r\n $ pip install PyAwk\r\n\r\nHistory\r\n-------\r\n0.1.0 (2014-02-21)\r\n~~~~~~~~~~~~~~~~~~\r\n* first release\r\n\r\nExample\r\n-------\r\nThis is a parser for LTSV formatted data.\r\nhttp://ltsv.org\r\n\r\n.. code-block:: python\r\n\r\n #!/usr/bin/env python3.3\r\n from pyawk import PyAwk, p\r\n class LTSVParser(PyAwk):\r\n def begin(self):\r\n self.FS = '\\t'\r\n self.count = 0 \r\n\r\n def action(self, S): \r\n if not p(S[0], r'status:200'):\r\n self.count += 1\r\n self.print('----------')\r\n d = {}\r\n for elem in S[1:]:\r\n key, value = elem.split(':', 1)\r\n d[key] = value\r\n self.print(d)\r\n\r\n def end(self):\r\n self.print('----------')\r\n self.print('Total:{}'.format(self.NR))\r\n self.print('Matched:{}'.format(self.count))\r\n\r\n if __name__ == '__main__':\r\n LTSVParser().run()\r\n\r\nThen you can execute this script with LTSV file.\r\n\r\n::\r\n\r\n $ ./ltstparser.py ltsv.log", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hideshi/PyAwk", "keywords": "Awk,Console", "license": "LGPL", "maintainer": "", "maintainer_email": "", "name": "PyAwk", "package_url": "https://pypi.org/project/PyAwk/", "platform": "MacOS,POSIX", "project_url": "https://pypi.org/project/PyAwk/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/hideshi/PyAwk" }, "release_url": "https://pypi.org/project/PyAwk/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "A framework which makes you to write scripts as if they were written in awk.", "version": "0.1.0" }, "last_serial": 1008521, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5a20c60951225217330ace994a5f18ec", "sha256": "7d00431872da7ff2ad2a2e3e715a4f6c3d08c73df551990b830440273fb1be28" }, "downloads": -1, "filename": "PyAwk-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5a20c60951225217330ace994a5f18ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2782, "upload_time": "2014-02-21T01:08:44", "url": "https://files.pythonhosted.org/packages/0d/da/67fb172603f16e2ee37a6d412be8f4f34db0db713cfbf526b4a5ea595dbc/PyAwk-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5a20c60951225217330ace994a5f18ec", "sha256": "7d00431872da7ff2ad2a2e3e715a4f6c3d08c73df551990b830440273fb1be28" }, "downloads": -1, "filename": "PyAwk-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5a20c60951225217330ace994a5f18ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2782, "upload_time": "2014-02-21T01:08:44", "url": "https://files.pythonhosted.org/packages/0d/da/67fb172603f16e2ee37a6d412be8f4f34db0db713cfbf526b4a5ea595dbc/PyAwk-0.1.0.tar.gz" } ] }