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
Thanks for every other great article. Where else may just anybody get that kind of info in such an ideal
manner of writing? I have a presentation next week,
and I’m at the look for such info.
Thanks for the marvelous posting! I quite
enjoyed reading it, you’re a great author.
I will ensure that I bookmark your blog and definitely will come back sometime soon.
I want to encourage one to continue your great work,
have a nice holiday weekend!
Attractive component to content. I simply stumbled upon your blog and
in accession capital to say that I get in fact loved account your weblog posts.
Any way I’ll be subscribing in your augment or even I fulfillment you get right of entry to constantly rapidly.
Greetings! This is my first comment here so I just wanted to
give a quick shout out and tell you I genuinely enjoy
reading your articles. Can you suggest any other blogs/websites/forums that cover the same subjects?
Thank you!
Hi therе, yup this article is genuinely pⅼeasant and I have
learned lot of things from it on the topic of blogging.
thanks.
Hi there i am kavin, its my first time to commenting anyplace,
when i read this paragraph i thought i could also create comment due to this brilliant piece of
writing.
It is not my first time to pay a quick visit this site, i am browsing this web
page dailly and get fastidious information from here all the time.
Incredible! This blog looks just like my old one! It’s on a completely different topic but it has pretty much the same layout and design. Great choice of colors!
I’m impressed, I must say. Rarely do I encounter a blog that’s equally educative and
engaging, and without a doubt, you have hit the nail on the
head. The problem is something which not enough
folks are speaking intelligently about. I’m very happy I came across this during my
search for something regarding this.
If you are going for most excellent contents like myself, just visit this site everyday because it offers quality contents,
thanks
I գuіte likje reading through an article that will make peopⅼe think.
Also, many thanks for allowing me to comment!
ai for trips
jarman.org.uk | Colourful grep on aix.
3 Common Reasons Why Your Must See Thai Women Chiang Mai Thailand Isn’t Performing (And The Best Ways To
Fix It)
my web-site :: date
Pretty section of content. I simply stumbled upon your weblog and in accession capital to claim that
I acquire actually enjoyed account your blog posts. Any way I will be
subscribing in your augment or even I fulfillment you get admission to consistently fast.
We’re a group of volunteers and opening a
brand new scheme in our community. Your web site
offered us with valuable info to work on. You have performed an impressive job and our
whole neighborhood will probably be grateful to you.
Thanks for another wonderful post. Where else may just anybody get that type of information in such
a perfect method of writing? I have a presentation subsequent week, and I’m at the search for such
information.
Just desire to say your article is as astonishing.
The clarity in your publish is just cool and that i could suppose you are an expert in this subject.
Fine together with your permission allow me to seize your feed to keep up to date with
approaching post. Thank you one million and
please carry on the rewarding work.
I always spent my half an hour to read this blog’s articles everyday along with a cup of coffee.
Fantastic post!
Check out: Sex Chat
NEWS (band)
This article provides clear idea in support of the new people of blogging, that in fact how to do blogging.
Hello to every body, it’s my first go to see of this webpage; this web site carries amazing and in fact excellent stuff for visitors.
My developer is trying to persuade 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 very good things about blogengine.net.
Is there a way I can transfer all my wordpress posts into it?
Any kind of help would be really appreciated!
ed drugs available in canada
Ηеllo to every one, it’s in fɑct a nice for me tⲟo ρay a visit thіs sitе, it includes important Information.
I’m really enjoying the design and layout of your site.
It’s a very easy on the eyes which makes it much more
pleasant for me to come here and visit more often. Did you hire out a developer to
create your theme? Fantastic work!
Hello! This post could not be written any better! Reading this post reminds me of my previous room mate!
He always kept chatting about this. I will forward this article to him.
Fairly certain he will have a good read. Many thanks for
sharing!
Когда пришло время продать мою машину,
я обратился в ‘Скупка авто’. Их подход превзошёл все мои ожидания.
Оценка прошла быстро и ясно, и оплата была мгновенной.
‘Скупка авто’ – идеальный выбор для быстрой продажи.
https://vykup-avto-kruglosutochno24.ru/.
You should be a part of a contest for one of the finest sites online.
I will highly recommend this web site!
Yes! Finally someone writes about lucrare de licenta.
I like the helpful info you provide in your
articles. I’ll bookmark your blog and check again here frequently.
I am quite certain I will learn many new stuff right
here! Best of luck for the next!
G᧐od wеb site yօou have goot here.. It’s hard to find excellent writing
lіke yours nowadays. I truly appгeciate pople like you!
Take care!!
My brother suggested I might like this blog.
He was entirely right. This post actually made my day.
You cann’t imagine just how much time I had spent for this information! Thanks!
1-kilo silver bars are stackable and easy to store.
Also visit my web-site: item575226385
Hello there! I know this is kinda off topic however ,
I’d figured I’d ask. Would you be interested in trading links or maybe guest authoring a
blog post or vice-versa? My website discusses a lot of the same topics as
yours and I feel we could greatly benefit from each other.
If you happen to be interested feel free to shoot me an e-mail.
I look forward to hearing from you! Fantastic blog by the way!
10 Meetups On Amazing Thai Dating Site Bangkok In Thailand
You Should Attend
Feel free to visit my blog Thai Dating App (warehousejobslocal.co.uk)
https://storage.googleapis.com/catering24/research/catering24-(245).html
The mother of the bride costume gallery has a dress for every price range and each physique kind together with plus
sizes.
Hello there, just became aware of your blog through Google, and found that it’s truly informative.
I am gonna watch out for brussels. I’ll appreciate if you continue this in future.
A lot of people will be benefited from your writing.
Cheers!
buy viagra online
Yourr mode of descrіbing the whole thing iin thiѕ paragraph is in fact nice, аll can witһoսt difficulty understand it,
Thanks a lot.
Pretty! This has been an extremely wonderful post.
Thanks for supplying this info.
I have read so many articles regarding the blogger lovers except this post is really a good paragraph,
keep it up.
There are many ways to search out the correct immigration lawyer to your case, from online serps
to legal professional databases like LegalMatch.
Our fees are simple to grasp and the value that you’re quoted is always the worth that
you simply pay.
Here is my site – UK Immigration Attorneys; http://beandrewforaday.com/,
Suggested Online site
blog topic
generic ed drugs india
смотреть сериалы онлайн качестве бесплатно
Zo zijn er gouden zegelringen wat tegenworodig helemaal in is.
Оптовая продажа морепродуктов – предпочтительное предложение для тех, кто ценит качество, свежесть и доступность.
Мы предлагаем широкий ассортимент высококачественных, свежих продуктов, включая икру, горбушу, форель и
креветки.
Вы можете быть уверены, что качество продукции, постоянно проверяется на всех этапах
производства и доставки. Мы также гарантируем своевременную и надежную доставку, поэтому наши клиенты (производители и продавцы продуктов питания) могут быть уверены, что получат свой товар в срок.
Наши цены – одни из самых выгодных
на рынке, что делает нас привлекательными для оптовых покупателей.
Мы постоянно работаем над оптимизацией нашей деятельности и улучшением условий сотрудничества для наших
клиентов.
Чтобы заказать нашу продукцию, посетите наш сайт!
Заходите на сайт портал рыба свежемороженая опт .
buy viagra online
Its like you read my mind! You appear to know so much 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 little bit, but instead of that, this is wonderful blog.
A great read. I will definitely be back.