Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to add 'color' in a grep? Post 303028454 by jim mcnamara on Tuesday 8th of January 2019 11:37:20 AM
Old 01-08-2019
I'm not sure what is going on for you. Try two separate grep actions (Linux example).
Ex:
grep -o shows ONLY the matching text nothing else on the line
You are looking for 10-JUL in a bunch of logfiles, then you want specific error code ERR 1901a

Code:
grep -f '10-JUL' logfiles*| grep -o 'ERR 1901a'

If you supply us an exact example of your problem we can help you apply this concept, otherwise this is about as good as I can do with what I have. An OS name and a shell name would help improve our answers immensely.
 

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

color highlighting with 'more','grep' and 'vi'

Hi all, i would to find out how can i turn on color hightlighting with the 'more' command. When i view a big file, i tend to use the 'more' command and i would search for a interested string with the '/' command. Something the search returns more than 1 line found on the screen, how can i... (0 Replies)
Discussion started by: new2ss
0 Replies

2. UNIX for Dummies Questions & Answers

Grep ruins color

When I run: git branch -a I git a nice green and red colored output, but if I pipe the above command through grep: git branch -a | grep -v "master" I lose my colored output. Is there a way around this? (2 Replies)
Discussion started by: blasto333
2 Replies

3. Shell Programming and Scripting

Add color in CSV cells

hi, i have text file that file contains below information. Name,Roll,Mark,Total Sivasankar,2120,89,410 Raja,2212,87,425 i need to convert text file to CSV file also the heading(Name,Roll,Mark,Total) font should be BOLD and color should be RED. how can i set fonts in csv (5 Replies)
Discussion started by: rsivasan
5 Replies

4. UNIX for Dummies Questions & Answers

How to add '--color' with pipes?

Hi guys - I was wondering if there is a way to add 'color' to a grep I do like this below: fgrep -i "XYZ-1124354-P" mylog.log | tr "\001" " " | sed G (7 Replies)
Discussion started by: DallasT
7 Replies

5. Shell Programming and Scripting

Add Color To html Doc

I have a script which converts a .csv file to html nicely. Trying to add 3 colors, green, yellow and red to the output depending upon the values in the cells. Tried some printf command but just can't seem to get any where. Any ideas would be appreciated. nawk 'BEGIN{ FS="," print ... (7 Replies)
Discussion started by: jimmyf
7 Replies
ZGREP(1)						    BSD General Commands Manual 						  ZGREP(1)

NAME
zgrep, zegrep, zfgrep -- print lines matching a pattern in gzip-compressed files SYNOPSIS
zgrep [grep-flags] [--] pattern [files ...] zegrep [grep-flags] [--] pattern [file ...] zfgrep [grep-flags] [--] pattern [file ...] DESCRIPTION
zgrep runs grep(1) on files or stdin, if no files argument is given, after decompressing them with zcat(1). The grep-flags and pattern arguments are passed on to grep(1). If an -e flag is found in the grep-flags, zgrep will not look for a pattern argument. zegrep calls egrep(1), while zfgrep calls fgrep(1). EXIT STATUS
In case of missing arguments or missing pattern, 1 will be returned, otherwise 0. SEE ALSO
egrep(1), fgrep(1), grep(1), gzip(1), zcat(1) AUTHORS
Thomas Klausner <wiz@NetBSD.org> BSD
December 28, 2003 BSD
All times are GMT -4. The time now is 04:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy