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
Транслируйте контент для взрослых безопасно, выбирая
проверенные веб-сайты для взрослых.
Используйте гарантированные источники для конфиденциального развлечения.
wettportal quotenvergleich
Here is my homepage – Basketball Wetten Doppeltes Ergebnis (https://Freeonlinecricketbettingtips.Com/Eishockey-3-Bundesliga-Tabelle/)
Woah! I’m really digging the template/theme of this
site. It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between user friendliness and appearance.
I must say you have done a very good job
with this. Also, the blog loads extremely fast for me on Firefox.
Superb Blog!
When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added
I get three emails with the same comment. Is there any way you can remove
me from that service? Thanks!
It’s very straightforward to find out any matter on net as compared to textbooks, as I
found this article at this web site.
Very good article. I’m going through a few of these issues as
well..
apuestas para ganar la eurocopa bayern vs barcelona
That is really attention-grabbing, You’re a very professional blogger.
I’ve joined your feed and look ahead to looking for extra of your excellent post.
Additionally, I have shared your site in my
social networks
新鲜xxx平台 提供创新的成人娱乐内容。发现 可靠的新网站 以获得现代化的体验。
Also visit my page 最佳肛门色情
Outstanding quest there. What occurred after?
Thanks!
avisador de cuotas apuestas Ufc chile
kasyno kryptowalutowe bonus (Thad) gdańsk paysafecard
Hey there would you mind letting me know which hosting company you’re utilizing?
I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a lot faster
then most. Can you suggest a good web hosting provider at a reasonable price?
Thank you, I appreciate it!
Very nice post. I just stumbled upon your blog and wished to mention that
I’ve truly loved browsing your blog posts. In any case I’ll be subscribing on your feed and I’m hoping you write once more very
soon!
I don’t know whether it’s just me or if everybody else experiencing problems with your website.
It seems 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 too? This could be a issue with my internet browser because I’ve had
this happen previously. Appreciate it
Excellent pieces. Keep posting such kind of info
on your site. Im really impressed by your
site.
Hi there, You’ve performed an incredible job. I will certainly digg it and personally recommend to my friends.
I am sure they will be benefited from this site.
I’ve been exploring for a little for any high quality
articles or weblog posts in this kind of area .
Exploring in Yahoo I eventually stumbled upon this web site.
Studying this information So i am glad to convey that I’ve an incredibly good uncanny feeling I found out just
what I needed. I most without a doubt will make sure to don?t disregard this web site and
give it a glance regularly.
Amazing! Its truly awesome piece of writing, I have got much
clear idea on the topic of from this article.
Hey there would you mind letting me know which hosting company
you’re using? I’ve loaded your blog in 3 completely different web
browsers and I must say this blog loads a lot faster then most.
Can you recommend a good hosting provider at a honest price?
Thanks, I appreciate it!
Thank you for another wonderful article. The
place else could anybody get that type of information in such
a perfect approach of writing? I have a presentation subsequent week, and I am on the search for
such info.
You ought to take part in a contest for one of the finest websites on the net.
I am going to recommend this site!
Wow, marvelous blog layout! How long have you been blogging for?
you made blogging look easy. The overall look of your website is fantastic, as well as the content!
Hello! This is kind of off topic but I need some
guidance from an established blog. Is it difficult to set
up your own blog? I’m not very techincal but I can figure things out pretty fast.
I’m thinking about creating my own but I’m not sure where to start.
Do you have any points or suggestions? With thanks
Keep this going please, great job!
I love what you guys tend to be up too. This type of clever work and coverage!
Keep up the fantastic works guys I’ve added you guys to my blogroll.
I know this if off topic but I’m looking into starting my own weblog and was wondering what all is needed to get setup?
I’m assuming having a blog like yours would cost
a pretty penny? I’m not very internet smart so I’m
not 100% certain. Any recommendations or advice would be greatly appreciated.
Thank you
These are in fact impressive ideas in regarding blogging.
You have touched some fastidious things here.
Any way keep up wrinting.
Hi, after reading this remarkable piece of writing i
am too glad to share my know-how here with mates.
Hello, i think that i noticed you visited my weblog thus i came to return the prefer?.I am attempting to to find issues to enhance my web
site!I assume its ok to use a few of your concepts!!
I know this website presents quality dependent content and additional
material, is there any other web page which offers these kinds of data in quality?
sportwetten anbieter ohne wettsteuer
Feel free to surf to my blog … basketball over Under Wetten
schweiz online sportwetten
my web page … 1Xbet Basketball Wetten
Excellent post. Keep writing such kind of info on your site.
Im really impressed by your site.
Hey there, You’ve done a fantastic job. I will definitely digg it and in my opinion suggest to my
friends. I am confident they will be benefited from this site.
Hello There. I found your blog using msn. This is a
really well written article. I’ll make sure to bookmark
it and return to read more of your useful information. Thanks for
the post. I’ll certainly return.
ping
jarman.org.uk | Colourful grep on aix.
It’s going to be end of mine day, however before finish I
am reading this enormous post to increase my know-how.
I’m extremely impressed with your writing abilities and also with the structure
on your blog. Is this a paid subject matter or did you customize it yourself?
Anyway keep up the excellent high quality writing, it is uncommon to see a nice weblog like this one these days..
I read this article completely regarding the difference of
hottest and previous technologies, it’s remarkable article.
I have read so many posts on the topic of
the blogger lovers except this paragraph is genuinely
a fastidious piece of writing, keep it up.
sportwetten ohne oasis mit paysafecard
Also visit my webpage – basketball wetten system (Quentin)
We are a gaggle of volunteers and opening a brand new scheme in our
community. Your web site provided us with helpful information to work
on. You have done a formidable job and our entire neighborhood will be thankful to you.
This is very interesting, You are an excessively professional blogger.
I have joined your rss feed and stay up for seeking more of your great
post. Also, I have shared your web site in my social networks
sloturi care platesc
my web site: free spins fara depunere romania casino
mejores casas real Madrid vs celta de vigo apuestas (https://uepa.Movix.com) apuestas españolas
Incredible points. Solid arguments. Keep up the great spirit.
kasyno internet sms szybka wypłata
zysk z ruletki
my web page … mobilní casino hazard (Cary)
real money casino usa online, best new zealandn online real
money pokies Unlimited Coins and spins For coin master dollar 1 deposit casino new zealand, or no deposit bonus aus casino
doble doble baloncesto Casas De Apuestas online En argentina
gry telewizyjne 350% bonus powitalny kasyno – Dino, online