Microsoft
Software
Hardware
Network
Question : Only the search string needs to be in color + awk.
The actual search expression is:
awk '/exception/ {i=1 ; while(i<=6) {print getline; i++} }' detail.log
I modified it to show the string exception to be in some color. Obviously, this is not correct all the lines are shown in color and also at the end of each line I see ;1.
I want only search string to be in color like grep --color=auto 'exception' detail.log. How do I do that?
awk '/exception/ {i=1 ; while(i<=6) {print "\033[1;34m" $0 "\033[0;00m;" getline; i++} }' detail.log
Answer : Only the search string needs to be in color + awk.
Why don't you use grep itself??
(-A tells grep to print 5 lines after the context is found)
1:
grep -A5 "exception" detail.log
Random Solutions
Microsoft Outlook 2007 is pulling duplicate emails from free hotmail live server - how can I prevent this, its driving me mad.
Enumerable or Strongly typed List of Guids
How to tranlate SQL query to WQL query for SCCM 2007
swf file won't play on the web
IP Address Contention
trying to print to HP laserjet 2050 - and constantly have to hit "ok" button to print
Problem getting the Selected value of a CheckBoxList (used in a gridview)
HP-UNIX - compressing/zipping files that are 31GB
Updating a Data Set that has been returned from a Function or DLL
Default Printer Changes using Terminal Server