Colourful grep on aix.
Linux implements a decent version of grep and highlights the search term using colour. Whilst AIX terminals can support colour (if your term session supports it) with escape codes I have not seen any way of making grep or egrep etc colourful.
On linux you simply add the parameter –color=auto such as
grep --color=auto SearchTerm {files}
Well as I couldn’t find anything on google I decided to implement something. And this is what I came up with. However the one bug I didn’t manage to resolve was If searching case insensitively the highlighting will only find the correct case. As sed does not support case insensitively this is a problem to solve. If nawk or gawk is installed, they do support it with the -i parameter.
#!/bin/ksh
#************************************************************************
# *
# Module Name : grepc.sh *
# Author : Dave Jarman +
# *
# Edit Record (most recent edit at top of list) *
# Date By CF Comments *
# --------- --- ---- --------------------------------------- *
# 5-Apr-12 DCJ i Use ampersand in sed search results as
# matched string to better handle regular
# expressions (thanks Zolo).
# 20-Sep-11 DCJ New file *
#************************************************************************
#
# Executes grep but with the escape codes to colourise the output.
#
# Known Bugs:
# If searching case insensitively the highlighting will only find the
# correct case. As sed does not support case insensitively this is a problem
# to solve. If nawk or gawk is installed, they do support it with the -i
# parameter.
#
# Other colours are available. Use the following lines.
# Blue echo "s/$QRY/\033[1;34m$QRY\033[0m/g" > $TMP/$$.sed
# Light blue echo "s/$QRY/\033[1;36m$QRY\033[0m/g" > $TMP/$$.sed
# Inverse blue echo "s/$QRY/\033[44;37m$QRY\033[0m/g" > $TMP/$$.sed
# Red echo "s/$QRY/\033[0;31m$QRY\033[0m/g" > $TMP/$$.sed
#************************************************************************
# Check for any options and save them
OPT=
while [[ $1 = [-+]?* ]]
do
OPT="$OPT $1"
shift
done
#
# Get the search string.
QRY=$1
shift
#
# Create a sed script to subsitiute for the appropriate colour.
# Show the search term in Blue
# echo "s/$QRY/\033[1;34m$QRY\033[0m/g" > $TMP/$$.sed
echo "s/$QRY/\033[1;34m&\033[0m/g" > $TMP/$$.sed
# echo /usr/bin/grep $OPT "$QRY" $* "|" sed -u -f $TMP/$$.sed
/usr/bin/grep $OPT "$QRY" $* | sed -f $TMP/$$.sed
#
# Clean up the tmp file *
rm $TMP/$$.sed
#
# Finish
exit 0
I feel this is among the most important information for me.
And i am happy reading your article. However should observation on few general things, The
website style is great, the articles is really excellent : D.
Good task, cheers
Howdy exceptional blog! Does running a blog similar to this require
a massive amount work? I have very little understanding of computer programming
however I was hoping to start my own blog in the near future.
Anyhow, if you have any suggestions or tips for new blog owners
please share. I know this is off subject nevertheless I just wanted to ask.
Thanks!
I’m not that much of a online reader to be honest but
your blogs really nice, keep it up! I’ll go ahead and bookmark your website to come back later on. All the best
Howdy, I do think your web site may be having internet browser compatibility issues.
When I take a look at your blog in Safari, it looks fine but when opening in IE, it’s got some overlapping issues.
I just wanted to provide you with a quick heads up!
Other than that, fantastic website!
https://mazda-demio.ru/forums/index.php?autocom=gallery&req=si&img=3760
NewULife Ranks. Welcome to my NewUlife Review.
Here is my web page – project management tools monday
Everything is very open with a clear description of the
challenges. It was truly informative. Your website is extremely helpful.
Many thanks for sharing!
equipaciones futbol niño
I was suggested this blog by way of my cousin. I am now not certain whether this publish is written by means of him as
nobody else recognise such exact approximately my problem.
You’re wonderful! Thank you!
Hey There. I found your blog using msn. This is an extremely well written article.
I will be sure to bookmark it and return to read more of your useful information. Thanks for the post.
I will definitely return.
My spouse and I absolutely love your blog and find most
of your post’s to be exactly what I’m looking for.
can you offer guest writers to write content for you?
I wouldn’t mind writing a post or elaborating on many of the subjects you write regarding here.
Again, awesome blog!
You really make it appear so easy with your presentation however I find this topic to be really something that I believe I might never understand.
It kind of feels too complicated and very huge for me.
I’m having a look forward for your subsequent post, I’ll try
to get the grasp of it!
First off I want to say excellent blog! I had a quick question in which I’d like to ask if you don’t mind.
I was interested to know how you center yourself and clear
your mind before writing. I’ve had a difficult time clearing my thoughts in getting my thoughts out there.
I truly do take pleasure in writing however it just seems
like the first 10 to 15 minutes are lost just trying to
figure out how to begin. Any suggestions or hints? Appreciate it!
Thank you a bunch for sharing this with all folks
you really realize what you’re speaking about! Bookmarked.
Kindly additionally seek advice from my site =). We could have a hyperlink
change agreement between us
my web site – binance futures signals Telegram
Thank you for the auspicious writeup. It in fact was a amusement account it.
Look advanced to far added agreeable from you! However, how can we communicate?
Up, up and away! Amazing pilot’s-eye view pictures show
just what it’s like to be one of the Red Arrows
By Alex Matthews For Mailonline
Published: 19:28 GMT, 25 April 2017 | Updated: 19:49 GMT, 25 April 2017
© SAC Hannah Beevers ñ MoD/Bav Media
© SAC Hannah Beevers ñ MoD/Bav Media
Pictured: The iconic jets of the RAF’s Red Arrows fly
in formation over Doncaster Sheffield Airport in East Yorkshire
Photos taken from cockpit of jet over skies of East Yorkshire
SAC Hannah Beevers captured images of various local landmarks
RAF Squadron renowned for daring displays with its
nine red jets
© SAC Hannah Beevers ñ MoD/Bav Media
Pictured: Red Arrows fly over the Humber
Bridge, near Kingston upon Hull, as the Squadron takes part in a training exercise
Incredible pilot’s-eye view pictures show what it is like to fly in the Red Arrows.
The photos where taken from the cockpit of the iconic jets as
the squadron trained over the skies of East Yorkshire.
Team photographer SAC Hannah Beevers captured images from
the backseat of Red 10’s jet – showing her comrades flying in formation.
The shots show the Squadron flying over York Minster, the Humber Bridge and
Humberside Airport before heading back to their base at RAF
Scampton in Lincolnshire.
The Squadron is renowned for daring displays and brought the whole formation together for the first time this season just three weeks ago.
The Red Arrows begin training for the forthcoming
season almost as soon as the previous year has ended.
Preparation starts with small groups of three or four aircraft formations and the formations grow in aircraft
number as training progresses.
© SAC Hannah Beevers ñ MoD/Bav Media
The Squadron, pictured passing over Humberside Airport, is renowned for its daring displays and brought the whole formation together for the first time this season just three weeks
ago
© SAC Hannah Beevers ñ MoD/Bav Media
The Squadron flew over the Humber Bridge, and Humberside Airport before heading back to their base at RAF Scampton in Lincolnshire
© SAC Hannah Beevers ñ MoD/Bav Media
Red Arrows’ training – pictured, the Squadron passing over Humberside
airport – starts with small groups of three
or four aircraft formations and then the formations grow in aircraft number as preparation progresses
Doncaster Sheffield Robin Hood Airport
Most watched News videos
Woman breaks down into tears after being arrested on murder charges
Self-styled TikTok millionaire brags about driving in London bus lane
NYPD officer fires fatal shot at man holding his own mother hostage
Sex offender gulps during arrest for masterminding paedophiles forum
Protestors tell Jewish man ‘we should beat the f*** out
of you’
Sex offender gulps during arrest for masterminding paedophiles forum
Gruesome details about Sarah Everard murder revealed in new doc
Modern Putin warship ‘hit and sunk’ by Ukraine strike
Scrap man takes £1,000 alloy wheels after asking to take sink
Onward Jeremy! Chancellor Hunt on morning run ahead of budget
Forest Gate police station in East London catches fire
Wayne Couzens stops at Costa after raping and murdering Sarah Everard
Comments 37
Share what you think
Newest
Oldest
Best rated
Worst rated
View all
The comments below have not been moderated.
View all
The views expressed in the contents above are those of our users and do not
necessarily reflect the views of MailOnline.
We are no longer accepting comments on this article.
Back to top
Home
News
Royals
U.S.
Sport
TV&Showbiz
Femail
Health
Science
Money
Travel
Shopping
Discounts
Sitemap Archive Video Archive Authors Topics Index Mobile Apps Screensaver RSS
Text-based site Reader Prints Our Papers Top of page
Daily Mail Mail on Sunday This is Money
Metro Jobsite Mail Travel Zoopla.co.uk Prime Location
Published by Associated Newspapers Ltd
Part of the Daily Mail, The Mail on Sunday & Metro Media Group
dmg media Contact us How to complain Leadership Team
Advertise with us Contributors Terms Subscription Terms
& Conditions Do not sell or share my personal
information About MailOnline Cookie Settings Privacy policy & cookies
I’m not sure where you are getting your information, but good topic.
I needs to spend some time learning more or understanding more.
Thanks for fantastic info I was looking for this information for my mission.
Hello, i believe that i saw you visited my site thus i got here
to go back the prefer?.I’m attempting to in finding issues
to improve my site!I suppose its good enough to
make use of some of your concepts!!
Heya i am for the primary time here. I came across this board and I to find It
truly useful & it helped me out much. I am hoping to present one thing again and aid others like you helped me.
XYGENYX, a licensing business for FDA-registered items.
Also visit my blog Best Project Management Software Microsoft
Thank you for the good writeup. It in fact was a amusement account it.
Look advanced to more added agreeable from you! By the way, how could we communicate?
Thanks for sharing your info. I truly appreciate your efforts and I will be waiting for your further write
ups thanks once again.
I for all time emailed this webpage post page
to all my friends, as if like to read it after that my contacts will too.
In this situation, the life insurance company’s loan.
Feel free to visit my homepage: monday project management software tutorial
USP human growth hormonal agent (somatropin).
My homepage … project management software reddit
In this case, the life insurance business’s loan.
My blog: item579402015
XYGENYX, a licensing company for FDA-registered products.
Feel free to surf to my webpage – item579225087
Authentic HGH Benefits (NewULife Hgh Gel Not Tested Yet).
Also visit my page … project Management software like monday
In this instance, the life insurance policy business’s cash.
Here is my webpage :: project Management Software microsoft teams
Hello there! I know this is somewhat off topic but I was wondering if
you knew where I could get a captcha plugin for my comment form?
I’m using the same blog platform as yours and I’m having
difficulty finding one? Thanks a lot!
I do not know whether it’s just me or if everybody else encountering issues with your site.
It looks like some of the text in your content are running off the
screen. Can somebody else please provide feedback and let me know if this is happening to them as well?
This might be a issue with my browser because I’ve had
this happen before. Kudos
What is New U Life SOMADERM Transdermal Gel.
my web page – monday project management software demo
They have products to market or services to
provide.
Review my web blog :: project management software
In this case, the life insurance policy company’s cash.
My web page :: project management software free trello
What is New U Life SOMADERM Transdermal Gel.
Here is my blog Bookmarks
I think the admin of this web page is really working hard
in favor of his website, for the reason that
here every material is quality based material.
XYGENYX, a licensing company for FDA-registered items.
Review my page: project management software tools list
Excellent blog! Do you have any tips and hints for aspiring
writers? I’m planning to start my own website soon but I’m a
little lost on everything. Would you advise starting with a free platform like WordPress
or go for a paid option? There are so many choices out there that I’m totally confused ..
Any ideas? Many thanks!
buy viagra online
payday loan
The application also uses the simplified payment verification (SPV) method, https://www.mycelium-wallet.com/, which provides a chance
to confirm transactions without the need watch from the Internet the entire blockchain.
Hello! Do you know if they make any plugins to protect against hackers?
I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?
Hi! Do you use Twitter? I’d like to follow you if that would be ok.
I’m undoubtedly enjoying your blog and look forward to new posts.
Also visit my website :: Delhi Escorts Service
I got this web page from my friend who shared
with me about this web page and at the moment this time I am browsing this site and
reading very informative articles or reviews at this time.
Hey there, You have done an excellent job. I’ll definitely digg it and
personally recommend to my friends. I am confident they will be benefited from this website.
Hmm is anyone else having problems with the pictures on this blog loading?
I’m trying to find out if its a problem on my end or if it’s the blog.
Any responses would be greatly appreciated.
Thanks a lot for sharing this with all folks you actually understand what you
are talking about! Bookmarked. Kindly additionally visit my web site =).
We can have a link trade contract among us
Hmm is anyone else experiencing problems with the images on this blog loading?
I’m trying to find out if its a problem on my end or if it’s the blog.
Any feedback would be greatly appreciated.
Hello! I’ve been reading your web site for a long time now and finally got the
bravery to go ahead and give you a shout out from Austin Tx!
Just wanted to say keep up the fantastic job!
Its like you read my mind! You appear to know a lot about this, like
you wrote the book in it or something. I think that you can do with
some pics to drive the message home a bit, but instead of that, this is wonderful blog.
A great read. I will certainly be back.