5

Is there a wrapper or a method to force the output of another program (let's say 7zip) inside a bash script to be formatted in a given way, say, coloured or indented? Or even run in a separate small graphical window? For example:

Current:

Welcome to program X v0.0.0
Packing file abc.xyz 10%...20%...30%...40%...50%...60%...70%...80%...90%...done
Exit. Good bye.

Expected:

Welcome to program X v0.0.0
   Packing file abc.xyz
   10%...20%...30%...40%...50%...60%...70%...80%...90%...done
Exit. Good bye.

Where the "Packing"... etc. is the output from this program.

2

GRC (generic colorizer) worth trying http://korpus.juls.savba.sk/~garabik/software/grc.html

By providing some regular expressions and color instruction codes in its configuration file, can have any output colorized. Example for traceroute below.

grc traceroute example

1

For coloring output, have a look at ccze, it's a log colorizer.

For indenting, you might try using awk depending on what you want indented and how. I don't think there are simpler tools.

  • 1
    Can you at least give an example? – Konrad Gajewski Aug 11 '15 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.