During debugging, color is used to print the data you care about.

Source: Internet
Author: User

Many friends, like me, compile and Debug Programs on Linux terminals. Sometimes there is a lot of output content,
Looking for the data you care about is very expensive. Later, I thought that the term could change the character color. It was so nice,
Export the output content to sed to highlight the desired characters.

For example, if my web application is published on Tomcat, I often use logger to output something.
Debug the program. So after running, I will stare at the output of Catalina. Out.

The following script prints the error in the row with the error string in Red:

#! /Bin/sh



Tail-F logs/Catalina. out | sed-E's // (error. * $/) // o033 [0; 31 m/1/o033 [0 m/G'

The following script also prints the exception in the line with the exception string in the blue sky:

 

Tail-F logs/Catalina. out | sed-E's // (error. * $/) // o033 [0; 31 m/1/o033 [0 m/G'-E's // (exception. * $/) // o033 [0; 36 M/1/o033 [0 m/G'

It is really much easier to catch errors in the color output. Looking at people in unknown places, the screen is green,
It looks very cool.

31 is red

32 is green

33 is yellow

34 is blue

35 is purple

36 is sky blue

37 is white

You can use these colors to highlight various requirements in different categories.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.