Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
¿Cómo mantengo los colores cuando canalizo la salida "jq" a "menos"?

Tengo un archivo json simple y si canalizo la salida de "jq" a "menos", los colores se eliminan.

Esto funciona:

 # yey, lots of colors jq "." /tmp/myfile.json

Esto no funciona:

 # ugly output :( , no colors jq "." /tmp/myfile.json | less -R

¿Alguna idea sobre cómo hacer que "menos" mantenga los colores?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Es jq el que suprime los colores. Desde la página del man

 o --color-output / -C and --monochrome-output / -M: By default, jq outputs colored JSON if writing to a terminal. You can force it to produce color even if writing to a pipe or a file using -C, and disable color with -M

Entonces, solo usa:

 jq -C "." /tmp/myfile.json | less -R

y generará colores independientemente. El comando less no necesita el interruptor -R en mi versión, pero creo que sí en versiones anteriores. Si ve los códigos ESC... , necesitará ese interruptor.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!