datefmt

format unix timestamps over stdin
git clone git://jb55.com/datefmt
Log | Files | Refs | README | LICENSE

datefmt.gmi (1745B)


      1 
      2 # datefmt
      3 
      4 datefmt is a simple C program that formats unix timestamps in text streams
      5 
      6 ## Examples
      7 
      8 Let's say we have some logs that contain unix timestamps:
      9 
     10 ```
     11 $ cat logs.txt
     12 
     13 EVENTS  1638499687   blahblah log1
     14 EVENTS  1638499717   blahblah log2
     15 ```
     16 
     17 We can pipe this log into datefmt to convert these timestamps into human-readable dates:
     18 
     19 ```
     20 $ <logs.txt datefmt
     21 
     22 EVENTS  2021-12-02 18:48   blahblah log1
     23 EVENTS  2021-12-02 18:48   blahblah log2
     24 ```
     25 
     26 Of course you can customize the format as well:
     27 
     28 ```
     29 $ <logs.txt datefmt "DATE:'%m-%d %R'"
     30 
     31 EVENTS  DATE:'12-02 18:48'   blahblah log1
     32 EVENTS  DATE:'12-02 18:48'   blahblah log2
     33 ```
     34 
     35 
     36 It's as simple as that! It comes with some heuristics so that it doesn't parse timestamp outside of a reasonable range.
     37 
     38 ## Download
     39 
     40 Tarballs are available here, please feel free to package this for your linux distribution of choice!
     41 
     42 => http://cdn.jb55.com/tarballs/datefmt/CHANGELOG.txt Changelog
     43 
     44 => http://cdn.jb55.com/tarballs/datefmt/datefmt-@VERSION.tar.gz Latest Version (@VERSION)
     45 
     46 => http://cdn.jb55.com/tarballs/datefmt/SHA256SUMS.txt SHA256SUMS
     47 
     48 => http://cdn.jb55.com/tarballs/datefmt/SHA256SUMS.txt.asc SHA256SUMS Signature
     49 
     50 => https://jb55.com/pgp.txt My pgp key
     51 
     52 Download and verify:
     53 
     54 * `wget https://jb55.com/pgp.txt http://cdn.jb55.com/tarballs/datefmt/datefmt-@VERSION.tar.gz http://cdn.jb55.com/tarballs/datefmt/SHA256SUMS.txt http://cdn.jb55.com/tarballs/datefmt/SHA256SUMS.txt.asc`
     55 * `gpg --import < pgp.txt`
     56 * `sha256sum -c SHA256SUMS.txt`
     57 * `gpg --verify SHA256SUMS.txt.asc`
     58 
     59 => http://cdn.jb55.com/tarballs/datefmt Older versions
     60 
     61 
     62 ## Contributing
     63 
     64 Send patches to `jb55@jb55.com`
     65 
     66 => http://git.jb55.com/datefmt Sources
     67 
     68 => https://git-send-email.io/ How to send email patches