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
Howdy great blog! Does running a blog similar to
this take a great deal of work? I’ve no expertise in coding however I was hoping to start my own blog in the near
future. Anyways, should you have any recommendations or techniques for
new blog owners please share. I understand this is
off topic however I just wanted to ask. Kudos!
Excellent blog you have here but I was wondering if you knew
of any message boards that cover the same topics discussed here?
I’d really love to be a part of community where I can get suggestions from other knowledgeable people that
share the same interest. If you have any suggestions,
please let me know. Thanks!
My web-site :: situs slot sawer138
Hi, I do think this is a great blog. I stumbledupon it 😉 I am going to come back yet again since
i have saved as a favorite it. Money and freedom is the best way to change, may you be rich and continue to guide
other people.
Mi nombre es Eva, resido esquiar en la pinilla Peligros
provincia de Granada y trabajo como economista. Estoy casado y tenemos
dos hijos, Mario de 7 años y Clara de 4.
Nice post. I learn something new and challenging on blogs
I stumbleupon on a daily basis. It’s always interesting
to read through content from other writers and practice a little something from other websites.
Hello, i think that i saw you visited my website so i came
to “return the favor”.I am attempting to find things
to enhance my web site!I suppose its ok to use a few of your ideas!!
My website; 赌球平台推荐
This page truly has all of the information and facts I needed
concerning this subject and didn’t know who to ask.
Also visit my web blog – roller rink management
Yes! Finally something about fraia.xyz.
who understands for sure. according to data 1inch, 1inchwallet.org, transactions on our service are up to 42% cheaper thanks to chi gastoken.
I all the time emailed this weblog post page to all my associates, since if like to read it afterward
my contacts will too.
https://www.ezsubscription.com/glf/store/cart.aspx?__x=add&pr=GLFISS11-3&qty=1&amt=6.95&srckey=7FS000&ref=https%3A%2F%2Fwww.reklameladen.de%2Ffirmeneintrag-loeschen%3Felement%3Dhttp%3A%2F%2F45.8.146.160
Spot on with this write-up, I absolutely feel this
site needs much more attention. I’ll probably be back again to
read through more, thanks for the information!
Here is my webpage; PDR
For latest news you have to pay a visit the web and
on the web I found this web site as a best site for newest updates.
Generally I don’t read post on blogs, but I would
like to say that this write-up very pressured me to take a look at and do so!
Your writing taste has been surprised me. Thanks, very great post.
Hurrah, that’s what I was exploring for, what a information! existing here at
this website, thanks admin of this website.
Thanks for the auspicious writeup. It in reality was once a entertainment account it.
Look complex to more introduced agreeable from you! By the way, how could we communicate?
Feel free to visit my webb site 카지노사이트
I’m now not positive where you’re getting your info,
but good topic. I must spend some time Machine learning much more or working out
more. Thank you for excellent information I was looking for this info for my mission.
Hi there, every time i used to check web site posts here in the early
hours in the break of day, as i love to learn more and more.
Also visit my web site :: roller rink event portable roller rink
Excellent post! We will be linking to this particularly
great content on our website. Keep up the great writing.
Hello there, just became aware of your blog
through Google, and found that it’s really informative. I am going to
watch out for brussels. I’ll be grateful if you continue
this in future. Lots of people will be benefited from your writing.
Cheers!
my homepage: Winnebago
Nice weblog here! Additionally your web site loads
up fast! What host are you the usage of? Can I am
getting your affiliate hyperlink in your host? I want my web site loaded up as quickly as yours lol
Here is my website; Prestige Southern Star
Hello there! I know this is kinda off topic but I was wondering which blog platform
are you using for this website? I’m getting fed up of
Wordpress because I’ve had problems with hackers and I’m looking at options for another platform.
I would be great if you could point me in the direction of a good platform.
https://catering1.research.au-syd1.upcloudobjects.com/research/catering1-(149).html
This robe comes complete with slits within the sleeves to keep her cool
at an out of doors wedding this summer.
What’s up to all, how is everything, I think every one is getting more from this web
site, and your views are nice for new users.
Here is my web blog – slot sawer138
Today, I went to the beach front with my
kids. I found a sea shell and gave it to my 4 year
old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and screamed.
There was a hermit crab inside and it pinched her ear. She never wants to go back!
LoL I know this is totally off topic but I had to tell someone!
Look at my web page net77 slot
fantastic submit, very informative. I’m wondering why the opposite experts
of this sector don’t understand this. You should continue your writing.
I am confident, you have a huge readers’ base already!
Wow, this post is nice, my sister is analyzing these things, therefore I am going to let know her.
my website Chaise Lounge
Cɑn Ӏ simply јust ѕay what a comfort to find someone that truly understands what they’гe discussing оn thе web.
You actually realize how to Ьгing a ⲣroblem to light and make it
importаnt. More and more people have to read thіs and understand
this sіde of yⲟur story. I was surprised tһat уоu aren’t morе popular givеn that you certainlү possess the gift.
After looking into a number of the articles on your web page, I seriously appreciate your technique of
writing a blog. I saved as a favorite it to my bookmark
site list and will be checking back soon. Please visit my web site as well and let me know what you think.
Thanks for your personal marvelous posting! I seriously enjoyed reading it, you’re a great author.
I will be sure to bookmark your blog and will come back from now on. I want to encourage yourself to continue your
great work, have a nice holiday weekend!
Inspiring story there. What happened after? Thanks!
My site: Leather Living Room Sets
porn videos
Helpful information. Lucky me I discovered your web site accidentally,
and I am stunned why this accident didn’t took place earlier!
I bookmarked it.
Simply desire to say your article is as astounding. The clarity for your put up is simply
nice and i could think you’re knowledgeable in this subject.
Fine with your permission let me to snatch your feed to stay up to date with impending post.
Thank you one million and please carry on the rewarding
work.
Pretty section of content. I just stumbled upon your site
and in accession capital to assert that I acquire in fact enjoyed account your
blog posts. Anyway I will be subscribing to your feeds and even I achievement you access consistently
quickly.
Thanks to my father who informed me concerning this website, this blog is in fact remarkable.
Wedding venues play a pivotal role in the vibrant city of Las Vegas, Nevada, where couples flock from around the world
to tie the knot. From extravagant ceremonies to intimate
gatherings, the choice of wedding location sets the tone for
one of life’s most memorable events. With a plethora of options
ranging from outdoor garden settings to elegant banquet halls, selecting the perfect venue is essential for
creating the wedding of your dreams.
Nestled in the heart of Las Vegas, Lotus House Events offers
couples a picturesque backdrop for their special day. Founded in the same year as the city itself, Lotus House Events is steeped in history and tradition,
mirroring the dynamic spirit of Las Vegas.
With a population of 646,790 residents and over 832,367 households, Las Vegas is a melting pot of diverse cultures and communities.
Interstate 11 traverses the city, providing convenient
access to neighboring areas and attractions.
In a city known for its extreme temperatures, ranging from scorching summers to mild winters, home
repairs are a constant consideration for residents.
Whether it’s air conditioning maintenance to beat the summer heat or roofing
repairs to withstand occasional rainfall, homeowners understand
the importance of budgeting for these expenses. On average, repairs typically range from a few hundred to several thousand dollars, depending on the nature
of the work required and the contractor hired.
Exploring the vibrant tapestry of Las Vegas’s attractions, residents and visitors alike are spoiled for choice.
From the whimsical wonders of AREA15 to the serene beauty
of Aliante Nature Discovery Park, there’s something for everyone to enjoy.
Thrill-seekers can brave the Asylum-Hotel Fear Haunted House, while art enthusiasts can marvel at the exhibits in the Arts District.
History buffs can delve into the Atomic Museum’s intriguing displays, while families can create lasting memories at the Discovery Children’s Museum.
Choosing Lotus House Events as your wedding venue in Las
Vegas ensures a seamless and unforgettable experience for you and
your guests. With a variety of indoor and outdoor spaces to
accommodate weddings of all sizes and styles, Lotus House Events offers unparalleled flexibility and customization options.
From expert wedding planning services to exquisite
catering and decor, every detail is meticulously curated to bring your vision to life.
With convenient packages and availability, Lotus House Events takes the stress
out of wedding planning, allowing you to focus on creating cherished memories that will
last a lifetime.
Hi therte colleagues, nice post and good urging commented here, I
am really enjoying by these.
My programmer is trying to convince me to move to .net from
PHP. I have always disliked the idea because of the costs.
But he’s tryiong none the less. I’ve been using Movable-type on a number of websites for about a year and am worried about switching to
another platform. I have heard fantastic things about blogengine.net.
Is there a way I can transfer all my wordpress
content into it? Any help would be really appreciated!
Take a look at my website ainu
I think the admin of this website is in fact
working hard in support of his web page, since here every stuff
is quality based information.
my web blog 온라인카지노
Hey thіs іs kіnda of off topic but I was wanting tto knoow if blogs
use WYSIWYG editors or if yyou have tо manually code wіth HTML.
I’m ѕtarting a bⅼog soon buut һave no ⅽoding ҝnow-how so I wanted tο get guidance frⲟm
ѕomeone with experience. Anyү help would be enormously appreciated!
It’s an awesome piece of writing designed for all the online people; they will obtain advantage from it I
am sure.
Heya i am for the first time here. I found this board and I in finding It truly useful
& it helped me out a lot. I’m hoping to offer one thing back and aid others like you aided
me.
This page really has all of the information I needed about this
subject and didn’t know who to ask.
Here is my webpage: alternatif badak69
I like it when people come together and share opinions.
Great site, continue the good work!
黑客论坛
jarman.org.uk | Colourful grep on aix.
Whoa all kinds of awesome information.
It’s amazing to pay a visit this website and reading the views of all mates about this piece of writing,
while I am also zealous of getting familiarity.
Great info. Lucky me I came across your blog by chance
(stumbleupon). I have book marked it for later!
Feel free to visit my webpage; slot sawer138
Ꭰoeѕ youyr ᴡebsite hɑve a contact page?
Ι’m having trouble locating іt but, I’d like to shoot you an email.
I’ve gοt somе suggestions for ʏour blog you might bеe inteгesteɗ in heaгing.
Either ԝay, greazt siote and I look forward to seeing іt exρand
ߋver time.
Hello There. I found your weblog using msn. This is an extremely neatly written article.
I’ll make sure to bookmark it and return to learn more of your helpful information. Thank you for
the post. I’ll definitely return.