On 08-07-2014 16:49, Shrinivasan T wrote: >> >> I am working on script creation for user audit report and last command >> doesn't o/p the year. >> I need to find year of the given date of month and day on linux box. >> Need to check only for past 10 years. >> example : >> >> input = Thu Apr 15 >> Required o/p 20140415 >> >> Any unix/linux commands or perl function would be good. > > The following python snippet can help you. > > sudo pip install timestring
Not a very good idea to pip install arbitrary packages from pypi into the system-wide python installation. It is a best practice to use something like virtualenv or buildout to isolate such packages required for specific project. To achieve this using virtualenv, you might have to use the following commands. Install virtualenv On Debian/Ubuntu based systems, the package to install for this is 'python-virtualenv'. Once it is installed, create a virtual python environment using the following command $ virtualenv /path/to/name-of-virtual-environment Activate it: $ source /path/to/name-of-virtual-environment/bin/activate Install the packages from pypi that you need for your project into the virtualenv. For example, $ pip install timestring When the virtualenv is activated, the 'python' command will be pointing to the isolated python installed within the virtualenv. So you can write your scripts and then run them by just invoking 'python' as you would do outside a virtualenv. Exit the virtualenv: $ deactivate To execute the script using the virtualenv without activating it, run $ /path/to/name-of-virtual-environment/bin/python your_script.py Thanks & Regards, Guruprasad
signature.asc
Description: OpenPGP digital signature
_______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc ILUGC Mailing List Guidelines: http://ilugc.in/mailinglist-guidelines
