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
Simply want to say your article is as astonishing.
The clarity in your post is just excellent and i could assume you are
an expert on this subject. Fine with your permission allow me to grab
your feed to keep up to date with forthcoming post. Thanks a
million and please continue the rewarding work.
I enjoy what you guys tend to be up too. This type
of clever work and reporting! Keep up the terrific works guys I’ve added you guys to
my personal blogroll.
my site … 우리카지노
Informative artiϲle, exactly what I was looking for.
Hey There. I found your blog using msn. This is an extremely well written article.
I will be sure to bookmark it and come back to read more of your useful
information. Thanks for the post. I’ll definitely comeback.
Admiring the persistence you put into your
site and in depth information you provide.
It’s good to come across a blog every once in a while that isn’t the same old
rehashed material. Wonderful read! I’ve saved your site
and I’m adding your RSS feeds to my Google account.
Here is my web-site … 우리카지노
With havin so much content do you ever run into any issues of plagorism or copyright violation? My blog has a lot of exclusive content I’ve either authored myself
or outsourced but it looks like a lot of it is popping it up all over the
internet without my permission. Do you know any methods to help protect against content
from being stolen? I’d truly appreciate it.
Además, la tecnología de reconocimiento biométrica se puede aprovechar para identificar
a delincuentes, criminales o terroristas conocidos con apoyo de
otros sistemas. Además, se verifica el número de serie y otros identificadores
únicos del dispositivo para confirmar su autenticidad.
En esta etapa se identifica (comparar la plantilla de un individuo con la
de muchos) o se verifica (compararla con la de uno mismo) una plantilla creada
por proyección de la imagen del iris con una plantilla de
valores almacenada en una base de datos. Existen otras técnicas con una tasa muy baja,
como la del iris o la huella dactilar, pero al asociarlas con entornos delictivos,
producen resistencia entre la población. También es importante tener en cuenta que,
aunque el escaneo del iris proporciona un alto nivel de seguridad, puede ser a expensas de la velocidad.
Seguridad. Una de las principales razones de su uso,
ya que proporcionan una alta seguridad al
no ser posible replicar las características únicas que otro individuo posee.
Los líderes de seguridad de la información deben emplear
metodologías paso a paso para ayudar en sus trayectos en esta nueva
era de evaluaciones de seguridad.
I needed to thank you for this excellent read!! I definitely loved every little bit of it.
I’ve got you book-marked to look at new things you post…
Wow, this post is nice, my younger sister is analyzing these kinds of things, thus I
am going to let know her.
my web page … dkmtoto
But if you win a jackpot in Georgia, right here is an in-depth
guide to assist you navigate the tax implications.
my blog post: Nc Lottery
I’m truly enjoying the design and layout of your site.
It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a
designer to create your theme? Fantastic work!
Pretty! This was a really wonderful post. Thanks for providing this information.
Feel free to visit my web site consultanta SEAP
Thanks for finally writing about > jarman.org.uk | Colourful grep on aix.
< Loved it!
Everything is very open with a very clear explanation of the challenges.
It was truly informative. Your site is very useful. Thank you for sharing!
Heya i’m for the primary time here. I came across this
board and I in finding It truly useful & it helped me out much.
I’m hoping to offer one thing back and help others like you helped me.
Link exchange is nothing else except it is
just placing the other person’s web site link on your page at suitable place and other person will also do similar in favor of you.
my site :: Graphic Print Shirt S-6XL Fashion
Hi! I could have sworn I’ve been to this website before but after checking through some of the post I realized
it’s new to me. Anyways, I’m definitely happy I found it and I’ll
be book-marking and checking back frequently!
It’s going to be end of mine day, however before end I am reading this
enormous paragraph to increase my experience.
What’s Happening i’m new to this, I stumbled upon this I’ve discovered
It positively useful and it has helped me out loads. I hope to give a contribution & aid different customers like its helped me.
Good job.
You’ve made some decent points there. I looked on the internet for more information about the issue and
found most people will go along with your views on this website.
Have a look at my web-site: Casual Men’s Hooded Street Style
What’s up everyone, it’s my first visit at this web page, and article
is in fact fruitful in favor of me, keep up posting these articles.
Its like you read my mind! You seem to know so much about this, like you wrote
the book in it or something. I think that you can do with
a few pics to drive the message home a little bit, but other than that, this is fantastic blog.
A fantastic read. I’ll definitely be back.
Hey very interesting blog!
Hello, I enjoy reading through your post. I wanted to
write a little comment to support you.
What’s up to all, how is everything, I think every one is
getting more from this website, and your views are good
in support of new users.
I just like the helpful info you provide in your articles.
I’ll bookmark your blog and test again right here regularly.
I am moderately sure I will be told many new stuff proper here!
Good luck for the following!
hoki 1881
Hurrah! After all I got a webpage from where I can actually obtain valuable data regarding my study and knowledge.
http://tumgerl.rolbb.me/viewtopic.php?id=11995#p18538
Link exchange is nothing else however it is simply
placing the other person’s webpage link on your page at suitable place and other person will also do similar
in support of you.
Hi, this weekend is good designed for me, because this occasion i am reading this wonderful educational piece of
writing here at my residence.
Great goods from you, man. I’ve understand your stuff previous
to and you are just too great. I actually like what you’ve acquired here,
really like what you are saying and the way in which you say it.
You make it enjoyable and you still care for to keep it wise.
I can not wait to read far more from you. This is really a wonderful website.
SR22 insurance is actually an essential element for reclaiming
full driving privileges. It is actually a form filed through your insurance company to show you are actually insured.
This insurance coverage criteria is normally for drivers with specific offenses.
Ensure you fully understand your SR22
insurance obligations.
my web page: High Stake poker
hello there and thank you for your information – I have definitely picked up anything new from right here.
I did however expertise several technical issues using
this website, as I experienced to reload the website a lot of
times previous to I could get it to load properly. I had been wondering if your web
hosting is OK? Not that I am complaining, but sluggish loading instances
times will sometimes affect your placement in google and
can damage your high-quality score if advertising and
marketing with Adwords. Well I am adding this RSS to my
email and could look out for much more of your respective interesting content.
Make sure you update this again soon.
Usually I do not learn article on blogs, however I would like to say that this write-up very pressured me to try and
do it! Your writing taste has been amazed me. Thank you, very great post.
Hi, I check your new stuff daily. Your story-telling style is witty, keep doing what you’re doing!
I think that is one of the such a lot important info for me.
And i am glad studying your article. However should observation on some
normal issues, The website taste is ideal, the articles is
in point of fact excellent : D. Good task, cheers
What i do not understood is if truth be told how you are no longer
really a lot more well-preferred than you may be right now.
You are so intelligent. You realize therefore significantly in the case of this
topic, produced me individually believe it from so many various angles.
Its like men and women are not involved except it’s one thing to accomplish with Girl gaga!
Your personal stuffs nice. All the time deal with it up!
Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet my
newest twitter updates. I’ve been looking for a plug-in like this for
quite some time and was hoping maybe you
would have some experience with something
like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.
Hurrah, that’s what I was looking for, what a material!
present here at this weblog, thanks admin of this site.
My web page; dkmtoto
I know this web site gives quality depending content and
extra stuff, is there any other website which presents
these kinds of stuff in quality?
I was wondering if you ever thought of changing the layout of your site?
Its very well written; I love what youve got to say.
But maybe you could a little more in the way of content so people
could connect with it better. Youve got an awful lot of text for
only having one or two pictures. Maybe you could space it out better?
I was very happy to find this site. I need to to thank you for
ones time for this particularly wonderful read!!
I definitely liked every bit of it and I have
you book marked to check out new information in your website.
My web-site :: 우리카지노
I’m impressed, I have to admit. Seldom do I encounter a blog that’s both equally educative and interesting,
and let me tell you, you have hit the nail on the
head. The issue is an issue that not enough folks are speaking intelligently about.
I am very happy that I stumbled across this in my hunt for something concerning
this.
Awesome article.
I like the helpful information you provide in your articles.
I will bookmark your blog and check again here regularly. I’m quite sure I’ll
learn many new stuff right here! Best of luck for the next!
An interesting discussion is worth comment.
I do think that you should publish more on this issue, it might not be a taboo subject but usually people do not discuss these topics.
To the next! Cheers!!
This is very interesting, You’re a very skilled blogger.
I have joined your rss feed and look forward to seeking more of your
magnificent post. Also, I’ve shared your website in my social networks!
However, come to the conclusion that the original {{https://www.jaxx-wallet.io/|www.jaxx-wallet.io} will actually lose access to {all|any} of your assets.