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 very nice blog!
You could certainly see your skills within the article you write.
The arena hopes for more passionate writers like you who are not afraid to say
how they believe. At all times follow your heart.
If some one wishes expert view about blogging and
site-building after that i recommend him/her to pay a quick visit
this web site, Keep up the pleasant job.
There’s certainly a lot to know about this subject.
I really like all the points you’ve made.
Touche. Great arguments. Keep up the amazing effort.
BJ 비제이 크리에이터 엔터테인먼트
blog topic
If you are going for most excellent contents like me, just go to see this web page all the time because it offers feature
contents, thanks
cost realizare site
I all the time emailed this webpage post page to all my friends, because if
like to read it after that my contacts will too.
I like what you guys are usually up too. This kind of clever work and coverage!
Keep up the amazing works guys I’ve incorporated you guys to
our blogroll.
Hi there! Quick question that’s completely off topic.
Do you know how to make your site mobile friendly? My web site looks weird
when viewing from my apple iphone. I’m trying to find a template or
plugin that might be able to resolve this problem.
If you have any recommendations, please share. Cheers!
I don’t know if it’s just me or if everybody else encountering issues
with your blog. It appears as if some of the text within 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 could be
a issue with my browser because I’ve had this happen previously.
Many thanks
Ahaa, its fastidious conversation on the topic of this article at this place at this website, I have
read all that, so now me also commenting here. http://opensug.s1009.xrea.com/discuss/profile.php?id=186449
Pretty section of content. I just stumbled upon your site and in accession capital to assert that I get in fact enjoyed account your blog posts.
Anyway I will be subscribing to your feeds and even I achievement you access consistently rapidly.
Ahaa, its fastidious conversation on the topic of this article
at this place at this website, I have read all that, so now
me also commenting here. http://opensug.s1009.xrea.com/discuss/profile.php?id=186449
I visit each day a few web pages and sites to read content, however this web site offers feature based content.
We are a group of volunteers and starting a new scheme inn
our community. Your site offere us with usedful info to work on. You’ve done a formidable activity and our whole community wll probably bee thankful to you.
소닉카지노 먹튀
can you stop taking actos
Very good blog you have here but I was curious
if you knew of any user discussion forums
that cover the same topics talked about here?
I’d really like to be a part of group where I can get advice from other knowledgeable people that share the same interest.
If you have any suggestions, please let me know. Bless you!
Post writing is also a excitement, if you be familiar with
afterward you can write otherwise it is complex to write.
When I originally left a comment I appear to
have clicked on the -Notify me when new comments are added- checkbox and now
every time a comment is added I recieve four emails with
the exact same comment. Is there a means you can remove me from that service?
Many thanks!
Al Studiya -Уникальная детская одежда по вашему заказу!
Ателье предлагает огромный выбор моделей и тканей
для маленьких модников.
Закажите у нас модные и удобные наряды
для ваших малышей и подчеркните
их индивидуальность! Приходите к нам и создайте лучший
образ для вашего малыша!
Заказ доступен здесь: https://al-studiya.ru/
Hiya! Quick question that’s completely off topic. Do you know how to
make your site mobile friendly? My website looks weird when viewing from my iphone.
I’m trying to find a theme or plugin that might be able to correct this problem.
If you have any recommendations, please share. Many
thanks!
It’s fantastic that you are getting ideas from this article
as well as from our dialogue made here.
My web page :: 海外号商
Hi there everybody, here every person is sharing such familiarity,
thus it’s pleasant to read this website, and I used to visit this weblog daily.
What’s up everyone, it’s my first go to see at this web site,
and paragraph is actually fruitful in support of me, keep up posting these content.
Excellent post. I used to be checking constantly this weblog and I’m
impressed! Very helpful information particularly the last phase
🙂 I take care of such information a lot. I used
to be seeking this particular info for a long time.
Thanks and best of luck.
I used to be able to find good info from your content.
Here is my page; Adjustable Baseball Caps for Women
I wɑs curious if you ever thought of changing the structure of your site?
Its very well written; I ⅼove what youve got to say.
But maybe you could a little more in thhe way of content so people ϲould connect wіth it better.
Youve got an awful lot of text fօг only һaving 1 oг twoo images.
Maybe you could space it out better?
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 little bit, but instead
of that, this is magnificent blog. An excellent read.
I’ll definitely be back.
Wow, wonderful blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your web site is excellent,
let alone the content!
Also visit my blog :: Pinoy SEO Services Philippines
Thanks for finally talking bout > jarman.org.uk | Colourful grewp on aix.
풀스윙 도메인
My spouse and I stumbled over here from a different website and thought I should check things out.
I like what I see so i am just following you. Look forward to exploring
your web page for a second time.
fantastic submit, very informative. I’m wondering why the other experts of
this sector do not understand this. You should proceed your
writing. I am sure, you’ve a huge readers’ base
already!
It’s in fact very complex in this active life to listen news on TV, so I
just use world wide web for that reason, and take the hottest
information.
Nice post. I was checking constantly this blog and I’m impressed!
Extremely useful info specifically the last part 🙂 I care for such info much.
I was looking for this particular information for a very long time.
Thank you and good luck.
I’m not sure why but this web site is loading incredibly slow for me.
Is anyone else having this problem or is it a problem on my end?
I’ll check back later on and see if the problem still exists.
Amazing blog! Do you have any tips for aspiring writers?
I’m planning to start my own blog soon but I’m a little
lost on everything. Would you propose starting with a free
platform like WordPress or go for a paid option?
There are so many choices out there that I’m totally overwhelmed ..
Any suggestions? Thank you!
Hi, for all time i used to check weblog posts here early
in the break of day, because i like to find out more and more.
Howdy! Would you mind iif I share your blog
with my twtter group? There’s a lot of folks that I think would really appreciate your content.
Please let me know. Thank you
Have a look at my web blog 카지노사이트
Thanks for your personal marvelous posting! I truly enjoyed
reading it, you could be a great author.
I will remember to bookmark your blog and may come back
from now on. I want to encourage you continue your great work, have
a nice evening!
Hey there, You have done an incredible job.
I’ll definitely digg it and personally suggest to
my friends. I’m sure they’ll be benefited from this
web site.
Look into my site :: สาระน่ารู้ทั่วไป
My brother suggested I would possibly like this website.
He used to be totally right. This publish actually made my
day. You can not believe just how much time I had spent for this info!
Thank you!
Here is my web page … A片
Right here is the right blog for anyone who would like to
understand this topic. You know a whole lot its almost tough to argue with you (not that I personally will
need to…HaHa). You certainly put a brand new spin on a
subject that has been written about for ages.
Great stuff, just great!
Hey! Someone in my Facebook group shared this website with us so I came to give it
a look. I’m definitely loving the information. I’m book-marking and will be tweeting this
to my followers! Outstanding blog and wonderful style and design.
Hi there! This is kind of off topic but I need some guidance from
an established blog. Is it very hard to set up your own blog?
I’m not very techincal but I can figure things out pretty quick.
I’m thinking about setting up my own but I’m not sure where to begin. Do you have any ideas or
suggestions? Many thanks
Howdy! I know this is kinda off topic however I’d figured I’d ask.
Would you be interested in exchanging links or maybe guest writing
a blog post or vice-versa? My site goes over a
lot of the same subjects as yours and I believe we could greatly benefit from each
other. If you’re interested feel free to shoot me an email.
I look forward to hearing from you! Wonderful
blog by the way!
I am really grateful to the holder of this web page who has shared this enormous
post at at this place.
Hi there, just became alert to your blog through Google, and found that
it is truly informative. I’m gonna watch out for brussels.
I will be grateful if you continue this in future. Lots of people will be benefited from your
writing. Cheers!
Hi, I would like to subscribe for this web site to take hottest updates, thnus where ccan i do
it please assist.
아시안커넥트