optional field separator for post-processing
authorDan White <dan@whiteaudio.com>
Thu, 12 Apr 2018 19:07:36 +0000 (14:07 -0500)
committerDan White <dan@whiteaudio.com>
Thu, 12 Apr 2018 19:07:36 +0000 (14:07 -0500)
TimeSampleHistogram

index 05a4262e98646415ad84ee74852ed4c94a396448..c6c6ebddb26a42013c5491d0e9a0165895daaf22 100755 (executable)
@@ -52,6 +52,8 @@ parser.add_option('-b', '--bare', dest='bare', action='store_true',
                   help='show histogram only', default=False)
 parser.add_option('-W', '--isoweek', dest='isoweek',
                   help='only show ISO [YYYY-]WK', default=None)
+parser.add_option('-f', '--field-sep', dest='sep', type='str',
+                  help='field separator', metavar='f', default='')
 (opt, args) = parser.parse_args()
 
 #testing
@@ -257,7 +259,10 @@ for k,v in sorted(hist.iteritems(), cmp=sorter):
     if len(k) > MAX_NAME_LEN:
         k = k[:MAX_NAME_LEN-1] + '~'
 
-    print ps % (k, v, '+'*tics(v))
+    if opt.sep == '':
+        print ps % (k, v, '+'*tics(v))
+    else:
+        print opt.sep.join((k, str(v)))
 
 if not opt.bare:
     print ('%%%is' % (name_len + count_len + 2)) % sum(hist.values())