- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Keywords patterns with different colors
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2015 05:58 AM - last edited on 02-27-2015 07:52 PM by Maiko-I
02-27-2015 05:58 AM - last edited on 02-27-2015 07:52 PM by Maiko-I
Keywords patterns with different colors
Hello,
does anyone can tell me if this is possible and if it is how?
I would like to set groups of keywords and set color for each group, so everytime I ran grep;cat; more; tail I can quickly see the words.
for example
a critical group with words like: "error"; "exception"; "NOK" as red
warning group as orange or yellow: "warning"; "advise"; "incorrect"
and other group green: "correct"; "OK"
I've seen this working in IBM AIX, but don't know how neither if it is possible in HP-UX
Thanks,
Diogo Rodrigues
P.S. This thread has been moved from HP-UX > Training & Education to HP-UX > languages. - Hp Forum Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2015 12:40 PM
02-27-2015 12:40 PM
Re: Keywords patterns with different colors
Nothing like that in HP-UX.
You would first have to determine what type of terminal you are using, as in:
Does it support color? There are HUNDREDS of terminal types listed in /usr/lib/terminfo. A vt100 terminal never had any color except white. If you are not using a real terminal, but a terminal emulator on a PC such as PuTTY or Reflection or hpterm or xterm, etc, then check to see whether there are color enhancements available. Some terminal emulators support ANSI colors, many do not, specfically HP terminals and emulators which have proprietary color codes.
If there are color enhancements available, many (not all) of the terminals listed in terminfo have their escape sequences defined in the terminfo files. You'll need to read the document: man terminfo to find the various color codes (Cap name), then use the tput command to form the sequence to start a color and then end a color.
Once you've got the color selection codes, you would then have to wrapper all the output sent to your screen to look for the keywords and insert the codes before and after each word.
And of course, this feature will be restricted to terminals that correctly identify themselves (ie, forcing TERM=vt100 is a bad idea).
Bill Hassell, sysadmin