Quantcast
Viewing all articles
Browse latest Browse all 524

How to pad numbers with JQ?

I'd like to add leading/trailing zeros to strings from numbers — resultant string needs to contain "01" or "001" and not "1". I noticed project https://github.com/joelpurra/jq-zeros but I have jq installed from package manager (dnf, fedora) so requirement of some jqnpm is not feasible for me (at first sight), not to mention my fear of npm, as stuff sudo npm -g ruined my system several times already.

Question:

  1. these package managers for jq, are they even in process of being accepted into mainstream or not?
  2. the padding itself — how to do it without this extra library?

Viewing all articles
Browse latest Browse all 524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>