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
Yesterday, while I was at work, my cousin stole my apple ipad and tested to see if it can survive a 40 foot drop,
just so she can be a youtube sensation. My apple ipad is
now broken and she has 83 views. I know this is totally
off topic but I had to share it with someone!
If you are going for most excellent contents like me, simply pay a quick visit this web site every day for the
reason that it provides quality contents, thanks
This site was… how do I say it? Relevant!! Finally I have found something that helped me.
Cheers!
Hurrah, that’s what I was looking for, what a material!
existing here at this weblog, thanks admin of this web page.
Hi there everyone, it’s my first visit at this web site, and post is really fruitful in favor of me, keep up posting these
articles or reviews.
Hello to every , for the reason that I am genuinely eager of reading this
weblog’s post to be updated on a regular basis.
It includes nice information.
I have been surfing on-line greater than 3 hours nowadays, but I by no means found any fascinating article
like yours. It’s lovely worth enough for me. In my view, if
all website owners and bloggers made good content material as you probably did,
the internet might be much more useful than ever
before.
We’re a group of volunteers and opening a brand
new scheme in our community. Your web site provided us with helpful info
to work on. You’ve performed an impressive activity and our whole group
can be grateful to you.
Hi there Dear, are you actually visiting this web site
regularly, if so then you will definitely take nice experience.
Your style is very unique compared to other folks I have read stuff from.
Thank you for posting when you have the opportunity, Guess I’ll
just book mark this web site.
I was very happy to discover this site. I need to to thank you for your time due to this fantastic read!!
I definitely savored every little bit of it and I have you book marked to look at new information in your blog.
What’s up all, here every one is sharing such familiarity, therefore it’s
nice to read this blog, and I used to pay a quick visit this
website every day.
Hey very interesting blog!
Heya i’m for the first time here. I came across this board and I find
It truly useful & it helped me out a lot. I hope to give something
back and aid others like you aided me.
Wonderful items from you, man. I have consider your stuff prior to and
you are just too fantastic. I really like what you have
got right here, certainly like what you are
saying and the way in which by which you assert it. You
make it entertaining and you still take care of to stay it sensible.
I can not wait to learn far more from you.
That is really a tremendous web site.
I really like what you guys are up too. This type of clever work and exposure!
Keep up the superb works guys I’ve added you guys to
blogroll.
blackjack enkhuizen emmen
geld winnen met beste wedden, Margret, tips apk 2026
It’s a pity you don’t have a donate button! I’d most
certainly donate to this excellent blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account.
I look forward to new updates and will talk about this blog with my Facebook group.
Talk soon!
Hey there, I think your blog might be having browser compatibility issues.
When I look at your website in Ie, it looks fine but when opening in Internet Explorer, it has
some overlapping. I just wanted to give you a
quick heads up! Other then that, very good blog!
roulette android
My site … casino mit auszahlung auf skrill
I go to see each day a few sites and websites to read content, but
this blog presents quality based writing.
777 casino united kingdom, free real online pokies united states and new no deposit casino 2021 australia, or
best live dealer casino usa
My page … Search casinos [Saddlesinc.in]
casino 50 euro sofortüberweisung
paysafecard ab 2 euro
are top online pokies and casinos united kingdom open, united kingdom casino in vegas and
blackjack mulligan usa, or canadian casino guide slot payback info
Also visit my web blog; gmod gambling district
remote gambling usa license, free spins sign up When Will The Casino In Eagle Pass Open australia and betting usa new jersey
online casinos bonus codes, or online slots united
states reddit
Definitely imagine that which you stated. Your favorite reason appeared
to be at the net the simplest thing to remember of. I say to you,
I certainly get annoyed at the same time as other folks think about
worries that they just do not recognize about. You controlled to
hit the nail upon the highest and also defined out the whole
thing with no need side effect , other folks could take a signal.
Will probably be again to get more. Thank you
kasyno online nowe bez depozytu (Chau) z wypłatą na kartę
kasyno wszystkie kasyna online w polsce polski
mega ball live od 10 kasyno Depozyt 15 Zł visa
Hi, its pleasant article about media print, we all understand media is a wonderful source of information.
gay porn
Security Verification
Magnificent beat ! I wish to apprentice while you amend your website, how can i subscribe for a blog web site?
The account helped me a appropriate deal. I were tiny bit familiar of this
your broadcast provided brilliant transparent idea http://fenjie888.com/comment/html/?51086.html
Magnificent beat ! I wish to apprentice while you amend your website,
how can i subscribe for a blog web site? The account helped me a appropriate
deal. I were tiny bit familiar of this your broadcast provided brilliant transparent idea http://fenjie888.com/comment/html/?51086.html
darmowe spiny Za aplikację kasyno Online kryptowaluty opinie
Howdy! Someone in my Myspace group shared this website with us
so I came to take a look. I’m definitely
loving the information. I’m book-marking and will be tweeting
this to my followers! Wonderful blog and wonderful design.
online pokies gambling australia, no deposit sign up bonus casinos usa and usa most money won at The casino fast withdrawal, or united statesn heritage poker table
kasyno online paysafecard
Here is my web page; Najlepsze JednoręKi Bandyta Z Bonusem
Hi there, just wanted to tell you, I liked this blog post.
It was practical. Keep on posting!
kasyno 250% poker bonus bez depozytu (Charolette) od depozytu
It’s very simple to find out any matter on net as compared to textbooks, as I found this piece of
writing at this site.
polskie kasyno online z cashbackiem (Ralph) z depozytem 3 euro
cazinouri cu free bet
My homepage … slot machine megaways (Samantha)
gambling online in usa, online casinos free spins no deposit
usa approved and 5 dollar deposit online the vault casino
game (Alannah) usa, or casinos in united states online
play online pokies for real money in canada, is there a casino dealer in taunton and how to hack canadian pokies, or european roulette layout usa
baccarat od 10 groszy
Stop by my web-site; 5 zł bez depozytu za rejestrację kasyno online; Jessika,
kasyno wrocław legalne
My homepage – ruletka na żYwo Za rejestrację (thefundingcoop.Org)
usa android when will South bend casino open bonus,
usa pokies online and best casino sites in canada, or australia gambling sites
Hi to every body, it’s my first pay a visit of this web site; this weblog contains remarkable and in fact good stuff for readers.
I am regular reader, how are you everybody? This piece of writing posted at this web site is in fact
pleasant.