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
скачать мостбет официальный mostbet11069.ru
гидроизоляция цена за м2 http://www.offthevylc.ru/polezno-znat/ceny-na-gidroizoljaciju-v-moskve-i-regionah-rossii.html/ .
гидроизоляция цена за м2 https://offthevylc.ru/polezno-znat/ceny-na-gidroizoljaciju-v-moskve-i-regionah-rossii.html .
We are a group of volunteers and starting a new scheme in our community.
Your website offered us with valuable info to work on. You have done a
formidable job and our whole community will be thankful
to you.
I read this paragraph fully concerning the difference of most recent
and previous technologies, it’s remarkable article.
гидроизоляция цена за м2 offthevylc.ru/polezno-znat/ceny-na-gidroizoljaciju-v-moskve-i-regionah-rossii.html .
This website was… how do you say it? Relevant!! Finally I
have found something which helped me. Thanks!
Why people still make use of to read news papers when in this technological world all is existing on web?
официальный сайт мостбет скачать http://www.mostbet11069.ru
мостюет mostbet11075.ru
You really make it appear really easy along with your presentation but I to find
this matter to be really one thing which I feel I
would by no means understand. It kind of
feels too complicated and very huge for me. I’m looking ahead in your
subsequent post, I’ll try to get the grasp of it!
Hmm is anyone else encountering problems with the images on this blog loading?
I’m trying to figure out if its a problem on my end or if it’s the blog.
Any suggestions would be greatly appreciated.
мостбет оригинал скачать https://www.mostbet11069.ru
Interesting blog! Is your theme custom made or did you download
it from somewhere? A design like yours with a few
simple adjustements would really make my blog jump out. Please let me know where you
got your design. Bless you
My website :: aqua win online casino
Inspiring story there. What occurred after?
Take care!
my web-site – online casino aquawin
This text is priceless. Where can I find out more?
Thank you a lot for sharing this with all people you really recognize what you are speaking about!
Bookmarked. Please additionally discuss with my site =).
We will have a link trade arrangement among us
мостбет кж mostbet11071.ru
Excellent web site you have got here.. It’s difficult to find quality writing like yours nowadays.
I truly appreciate people like you! Take care!!
I’m curious to find out what blog platform you’re working with?
I’m having some minor security issues with my latest website and I’d like to find something
more safeguarded. Do you have any recommendations?
What i do not understood is if truth be told how you’re not really a lot more well-favored than you might be now.
You are very intelligent. You understand thus significantly in relation to this topic, produced me
personally believe it from a lot of numerous angles.
Its like men and women are not interested until it is one thing to do
with Girl gaga! Your own stuffs outstanding. At all times take care of it up!
Today, I went to the beach front with my children.
I found a sea shepl annd gave itt to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell
to her ear and screamed. There was a hrmit crab inside and it pinched her ear.
She never wants to go back! LoL I know this is entirely off topic but
I had to tell someone!
Feeel free to surf to my page … Email For Verification
Wonderful goods from you, man. I’ve understand your stuff previous to and you’re just too wonderful.
I actually like what you have acquired here, really like what you are saying and
the way in which you say it. You make it entertaining and you
still care for to keep it sensible. I can’t wait to read much more from you.
This is actually a great website.
pharmacy prescription
гидроизоляция цена за м2 http://offthevylc.ru/polezno-znat/ceny-na-gidroizoljaciju-v-moskve-i-regionah-rossii.html .
следует отметить, покердом акции что сделать ставку в
ПокерДоме с компьютера можно через обыкновенный браузер или скачиваемый.
canadian drug
профессиональные прогнозы на футбол профессиональные прогнозы на футбол .
гидроизоляция цена за м2 http://offthevylc.ru/polezno-znat/ceny-na-gidroizoljaciju-v-moskve-i-regionah-rossii.html/ .
mostbet kg регистрация mostbet kg регистрация
My blog – highstakesdb
I don’t even understand how I finished up right here, however I believed this post was once great.
I do not recognize who you are however certainly you are going to a well-known blogger if
you are not already. Cheers!
Aqua Sculpt sounds amazing! ✨ The idea of using a water-based approach to help shape the
body and support fat loss is really unique. I like
that it’s designed to be gentle yet effective, making it a great option for people who want results without extreme methods.
My programmer is trying to convince me to move to
.net from PHP. I have always disliked the idea because of the expenses.
But he’s tryiong none the less. I’ve been using Movable-type on numerous websites for about a year
and am worried about switching to another platform. I have heard excellent things about blogengine.net.
Is there a way I can import all my wordpress content into it?
Any help would be greatly appreciated!
Hello there! This article couldn’t be written much better!
Going through this article reminds me of my previous roommate!
He continually kept talking about this. I will send this information to him.
Pretty sure he’s going to have a good read. Thanks for sharing!
approved canadian online pharmacies
Hey There. I found your blog using msn. That
is a really neatly written article. I’ll make sure to bookmark
it and return to learn extra of your useful information. Thank you for
the post. I’ll definitely return.
I always emailed this web site post page to all mmy
contacts, as if like to read iit next my friends will too.
Here is my site :: VDS Kirala
цветочный горшок с автополивом цветочный горшок с автополивом .
I’m not certain the place you are getting your info, but great topic.
I must spend a while studying more or working out more.
Thanks for fantastic info I was looking for this info
for my mission.
It’s nearly impossible to find experienced people for this topic, but
you sound like you know what you’re talking
about! Thanks
Thank you for the auspicious writeup. It in fact was a
amusement account it. Look advanced to far added agreeable from you!
However, how could we communicate?
Hi, Neat post. There’s a problem along with your website in internet explorer,
would check this? IE nonetheless is the market leader and a large section of folks
will omit your magnificent writing due to this problem.
мостбет кг мостбет кг
I know this web page gives quality depending content and additional stuff, is there any other website which offers these things
in quality?
At this time it looks like Drupal is the best
blogging platform available right now. (from what I’ve read)
Is that what you’re using on your blog?
Thanks for the auspicious writeup. It in truth was once a enjoyment account it.
Look complicated to more delivered agreeable from you!
By the way, how could we communicate?
I’m gone to tell my little brother, that he should also
go to see this web site on regular basis to take
updated from hottest information.
You’ve made some decent points there. I looked on the web to learn more
about the issue and found most people will go along with your views
on this web site.
You’ve made your point.