{"id":13584741,"url":"https://github.com/mdom/dategrep","last_synced_at":"2025-04-04T19:09:43.764Z","repository":{"id":15222911,"uuid":"17951494","full_name":"mdom/dategrep","owner":"mdom","description":"print lines matching a time range","archived":false,"fork":false,"pushed_at":"2025-01-03T08:26:56.000Z","size":1805,"stargazers_count":177,"open_issues_count":0,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T18:11:20.648Z","etag":null,"topics":["command-line-tool","daterange","grep","logging","perl","timestamp","unix"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdom.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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,"publiccode":null,"codemeta":null}},"created_at":"2014-03-20T17:19:48.000Z","updated_at":"2025-01-19T23:15:51.000Z","dependencies_parsed_at":"2025-03-01T17:20:36.586Z","dependency_job_id":null,"html_url":"https://github.com/mdom/dategrep","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdom%2Fdategrep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdom%2Fdategrep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdom%2Fdategrep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdom%2Fdategrep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdom","download_url":"https://codeload.github.com/mdom/dategrep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"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":["command-line-tool","daterange","grep","logging","perl","timestamp","unix"],"created_at":"2024-08-01T15:04:29.616Z","updated_at":"2025-04-04T19:09:43.736Z","avatar_url":"https://github.com/mdom.png","language":"Perl","funding_links":[],"categories":["Perl"],"sub_categories":[],"readme":"# NAME\n\ndategrep - print lines matching a time range\n\n# SYNOPSIS\n\n    dategrep --start \"12:00\" --end \"12:15\" syslog\n    dategrep --end \"12:15\" --format \"%b %d %H:%M:%S\" syslog\n    dategrep --last-minutes 5 syslog\n    cat syslog | dategrep --end \"12:15\"\n\n# DESCRIPTION\n\ndategrep reads a file and prints every line with a timestamp that\nfalls into a user defined time range.\n\nWhen invoked on a normal file, dategrep uses a binary search to\nfind the first matching line. It can also read from stdin and\ncompressed files but in this case it has to parse the timestamp of\nevery line until the first matching line is found.\n\nAs soon as it finds the first date not in the range, dategrep\nterminates.\n\ndategrep can already parse some common logs formats like rsyslog\nand apache common log format. Additional formats can be used by\nsupplying a [strptime(3)](http://man.he.net/man3/strptime) format string.\n\nSee UPGRADING if you used dategrep before. dategrep sees currently\na lot of change, so this version might be less reliable as version\n0.58. Please submit bug reports if anything unusual happens.\n\n# EXAMPLES\n\nPrint all lines between 12:00 and 12:15:\n\n    dategrep --start 12:00 --end 12:15 syslog\n\nWithout --start, print all lines after epoch:\n\n    dategrep --end 12:15 syslog\n\nUsing a user supplied format string:\n\n    dategrep --format \"%b %d %H:%M:%S\" syslog\n\nPrinting all lines from the last 5 minutes.\n\n    dategrep --last-minutes 5 syslog\n\nReading from compress files or stdin:\n\n    cat syslog | dategrep --end 12:15\n    dategrep --end 12:15 syslog.gz\n\n# OPTIONS\n\n- --start|--from DATE\n\n    Print all lines from DATE inclusively. Defaults to Jan 1, 1970 00:00:00 GMT.\n\n    The following time formats are understood:\n\n    - %H:%M\n    - %H:%M:%S\n    - %Y-%m-%dT%H:%M:%S\n    - %Y-%m-%dT%H:%M:%S%Z\n    - now\n\n    A missing date defaults to today. Missing time components default\n    to zero.\n\n    Relative dates can be expresses by truncating dates to the nearest\n    multiple of a duration and by adding a duration.\n\n    A duration string is a signed numbers and a unit suffix, such\n    as \"300m\", \"-1h30m\" or \"2h45m\". Valid time units are \"s\", \"m\",\n    \"h\".\n\n    For example,\n\n        --from \"now truncate 1h add 17m\" --to \"now truncate 1h add 1h17m\"\n\n    would search entries from 16:17 to 17:17 if the current time was 17:30.\n\n- --end|--to DATE\n\n    Print all lines until DATE exclusively. Defaults to the current time. See\n    _--start_ for a list of possible formats for DATE.\n\n- --last-minutes MINUTES\n\n    Print all lines from MINUTES minutes ago until the beginning of the current\n    minute. So if we have 19:25:43 and MINUTES is five, dategrep will print all\n    lines from 19:20:00 to 19:24:59.\n\n- --format FORMAT\n\n    Defines a time format that is used to parse the input lines for a date.  The\n    time format string can contain the conversion specifications described in the\n    _strptime(3)_ manual page. Currently only the specifiers\n    \"AaBbcHMSdDIlmnYzZRrTFehkCyXx%\" are supported.\n\n    Any fractional seconds (e.g., nanoseconds) included in the input\n    string are skipped and ignored for the purposes of date and time\n    calculations. The %S specifier only processes the integer part of\n    the seconds value and does not retain or utilize nanoseconds in\n    computations.\n\n    This option can be given multiple times. In this case dategrep tries\n    every format in the order given until it can match a line.\n\n    Without a user supplied format, dategrep tries all time formats it knows about.\n\n    Alternatively you can supply the format via the environment variable\n    _DATEGREP\\_DEFAULT\\_FORMAT_.\n\n- --multiline\n\n    Print all lines between the start and end line even if they are not timestamped.\n\n- --skip-unparsable\n\n    Ignore all lines without timestamp. Disables _--multiline_.\n\n- --blocksize SIZE\n\n    SIZE of the intervals used in the binary search. Defaults to the native\n    blocksize of the file's filesystem or 8129.\n\n- --interleave\n\n    Print lines sorted by timestamp even if the timestamps in the input files\n    are overlapping.\n\n- --sort-files\n\n    Sort files in the order of the first line with a timestamp. For example:\n    If you have a common logrotate configuration, you probably have files\n    like syslog, syslog.1, syslog.2 etc. For dategrep to work we need those\n    files in reverse order: syslog.2, syslog.1, syslog. This options handles\n    that for you.\n\n- --help\n\n    Shows a short help message\n\n- --man\n\n    Shows the complete man page in your pager.\n\n# ENVIRONMENT\n\n- DATEGREP\\_DEFAULT\\_FORMAT\n\n    Default for the _--format_ parameter. The syntax is described there.\n\n# COMPRESSED FILES\n\ndategrep has only minimal support for compressed files. If any file in\nARGV has an extension like _.z_,_.gz_,_.bz2_,_.bz_, dategrep will\ncall _zcat_ or _bzcat_ respectively and read from it like from stdin.\n\n# LIMITATION\n\ndategrep expects the files to be sorted. If the timestamps are not\nascending, dategrep might be exiting before the last line in its date\nrange is printed.\n\nCompressed files are just piped into dategrep via bzcat or zcat.\n\n# SEE ALSO\n\n[strptime(3)](http://man.he.net/man3/strptime)\n\n# INSTALLATION\n\nThe easiest way to install dategrep is to just build it as a\nstandalone script:\n\n    ./build-standalone\n    ./dategrep\n\nCheck [https://github.com/mdom/dategrep/releases/latest](https://github.com/mdom/dategrep/releases/latest) for\nprebuild scripts.\n\nIt is possible to install this script via perl normal install routines.\n\n    perl Build.PL \u0026\u0026 ./Build \u0026\u0026 ./Build install\n\nOr via CPAN:\n\n    cpanm App::dategrep\n\nyamlCase maintains an Dockerfile for dategrep at\n[https://github.com/yamlCase/dategrep/tree/dockerfile\\_poc](https://github.com/yamlCase/dategrep/tree/dockerfile_poc).\n\n# UPGRADING\n\ndategrep after version 0.58 uses a new library to parse dates. Most\ntime conversion specifiers are compatible, but it's probably better\nto check the manual for valid specifiers. In addition the format\nfor specifying date offsets has changed.\n\n# COPYRIGHT AND LICENSE\n\nCopyright 2014 Mario Domgoergen `\u003cmario@domgoergen.com\u003e`\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see \u0026lt;http://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdom%2Fdategrep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdom%2Fdategrep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdom%2Fdategrep/lists"}