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
Fastidious response in return of this difficulty with firm arguments and explaining the
whole thing regarding that.
Hi there every one, here every one is sharing these know-how,
thus it’s nice to read this website, and I used to go to
see this webpage daily.
Look into my site; Intelligenza artificiale
If some one wants to be updated with most recent technologies then he must be pay a
quick visit this website and be up to date daily.
Feel free to surf to my web blog Mid Century Modern Dining Chairs
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/accounting7/research/accounting7-(146).html
Black is just about accepted these days, no matter the occasion.
This is really interesting, You’re a very skilled blogger.
I’ve joined your feed and look forward to seeking more of your wonderful post.
Also, I have shared your web site in my social networks!
My homepage :: Java
https://accounting005.netlify.app/research/accounting005-(323)
If full skirts and punchy prints aren’t your
mom’s go-to, attempt a press release sleeve.
The final stage is oriented at lifting the growth of the ecosystem and developing the community, including https://poodle-inu.io/ to
dominate the area of meme coins.
You really make it seem so easy with your presentation but I find this matter
to be actually something which I think I would never understand.
It seems too complicated and extremely broad for me.
I’m looking forward for your next post, I’ll try to get the hang of it!
I like the helpful info you provide to your articles.
I will bookmark your blog and check once more right here regularly.
I’m rather sure I’ll be informed plenty of new stuff proper right
here! Good luck for the next!
https://accounting12.b-cdn.net/research/accounting12-(205).html
For the mother whose style is modern and minimal, go for a robe with an architectural silhouette in her favourite color.
https://accounting4.research.au-syd1.upcloudobjects.com/research/accounting4-(150).html
Black is also one other dangerous color, but can work perfectly properly at more formal weddings.
Heya i’m for the first time here. I found this board and I find It truly useful & it helped me
out much. I hope to give something back and aid others like you aided
me.
This design is steller! You obviously know how to keep a reader entertained.
Between your wit and your videos, I was almost moved to start my own blog (well,
almost…HaHa!) Wonderful job. I really enjoyed what you had to
say, and more than that, how you presented it.
Too cool!
Here is my webpage … login sawer138
Hello! I know this is somewhat off topic but I was wondering if
you knew where I could find a captcha plugin for my comment
form? I’m using the same blog platform as yours and I’m having problems finding one?
Thanks a lot!
What’s up everybody, here every person is sharing such knowledge, therefore it’s fastidious to read this webpage, and I used to go to
see this weblog everyday.
http://catering103.s3-website-us-west-1.amazonaws.com/research/catering103-(15).html
Another costume with ruching for you as I assume ruched kinds are
so flattering.
https://accounting004.netlify.app/research/accounting004-(54)
Draw inspiration from mix-and-match bridesmaid clothes by
selecting a color that coordinates with, but would not precisely match, the maids palette.
hi!,I really like your writing very a lot! percentage we keep in touch extra approximately your article on AOL?
I require a specialist in this area to solve my problem.
May be that is you! Having a look ahead to see you.
Also visit my site: alternatif badak69
https://accounting-6.blr1.digitaloceanspaces.com/research/accounting6-(255).html
The following are some issues to consider when selecting between attire.
Hi there, just became alert to your blog through Google,
and found that it is really informative. I am going to watch out for brussels.
I will appreciate if you continue this in future.
Many people will be benefited from your writing. Cheers!
After going over a handful of the blog articles on your web page, I honestly like your
technique of writing a blog. I added it to my bookmark site list and will be checking back soon. Take a look at my website as well and
tell me what you think.
Feel free to surf to my page; slot badak69
https://accounting-4.fra1.digitaloceanspaces.com/research/accounting4-(429).html
This lace look feels special and festive,
without a print, daring shade, or dramatic sleeve in sight.
Magnificent goods from you, man. I have understand your
stuff previous to and you’re just extremely magnificent.
I really like what you’ve acquired here, really like what you are stating and the way in which you say it.
You make it enjoyable and you still care for to keep it sensible.
I can’t wait to read far more from you. This is really a wonderful site.
My web page: Internet delle cose
http://accounting0006.s3-website.ap-east-1.amazonaws.com/research/accounting0006-(23).html
Carrie Crowell had come across the silk gown that her mom, country singer Rosanne Cash, wore
at her 1995 wedding to Carrie’s stepfather.
https://storage.googleapis.com/accounting0015/research/accounting0015-(82).html
Mother of the bride attire needn’t feel frumpy or overly conservative!
Heya i am for the primary time here. I found this board
and I in finding It really helpful & it helped
me out much. I hope to present one thing back and help others like
you aided me.
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/accounting23/research/accounting23-(425).html
Embroidery is a timeless trend, and it is by no means hoped to exit of fashion.
https://accounting18.b-cdn.net/research/accounting18-(80).html
A purple lace Erdem dress, embroidered with pink and crimson blooms, paired
completely with this modern mother’s half-up, half-down hairstyle.
May I just say what a comfort to discover an individual who actually understands what they are discussing on the net.
You certainly realize how to bring a problem to light and
make it important. More and more people really need to check this out and
understand this side of the story. I can’t believe you aren’t more popular because you certainly possess the gift.
My site; Mid Century Modern Dining Chairs
Greate pieces. Keep writing such kind of info on your site.
Im really impressed by it.
Hello there, You’ve performed a great job. I’ll certainly digg it and for my
part suggest to my friends. I am sure they’ll be benefited from this site.
https://accounting011.netlify.app/research/accounting011-(247)
Following these easy guidelines are certain to make the process go easily and
effectively.
https://accounting006.netlify.app/research/accounting006-(402)
Jovani provides you the highest highest quality MOB gowns for a low price.
https://accounting011.netlify.app/research/accounting011-(461)
From the floor-sweeping A-line skirt to the on-trend off-the-shoulder sleeves, there’s a lot to like.
What’s Going down i am new to this, I stumbled upon this I’ve found It
positively helpful and it has helped me out loads.
I’m hoping to contribute & help different customers
like its aided me. Good job.
My web blog – alternatif badak69
Very nice post. I absolutely appreciate this site. Continue the good work!
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/accounting7/research/accounting7-(84).html
Check out the information for nice suggestions and ideas, and prepare to cut a dash at your daughter’s D-day.
Neat blog! Is your theme custom made or did you download it from somewhere?
A design like yours with a few simple adjustements would really make my blog stand out.
Please let me know where you got your design. Thank you
Appreciation to my father who shared with me regarding this blog, this website is genuinely remarkable.
My homepage … Intelligenza artificiale
https://accounting008.netlify.app/research/accounting008-(422)
I might play a role in my stepdaughter’s wedding ceremony
or I won’t.
http://digimarketing24.s3-website.eu-south-1.amazonaws.com/research/digimarketing24-(549).html
The entire look was the perfect match for the couple’s tradition-filled day.
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/accounting24/research/accounting24-(391).html
Don’t be afraid of anything oversized—the giant
bow of this robe will flatter small busts, and make waists and arms appear petite as compared.
https://accounting0006.z12.web.core.windows.net/research/accounting0006-(32).html
The fall colours are normally earthy and on the darker side,
but always ask your daughter what she has in mind.
For the reason that the admin of this site is working, no question very rapidly it will be
renowned, due to its quality contents.
Stop by my page: Teddy Chair
Attractive section of content. I just stumbled upon your website and in accession capital to
assert that I acquire actually enjoyed account your blog posts.
Anyway I will be subscribing to your feeds and even I achievement you access consistently quickly. https://Bossgirlpower.com/forums/profile.php?id=237653
Attractive section of content. I just stumbled upon your website and in accession capital to assert
that I acquire actually enjoyed account your blog posts. Anyway I will be subscribing to
your feeds and even I achievement you access consistently quickly. https://Bossgirlpower.com/forums/profile.php?id=237653
https://accounting1013.s3.us-west-004.backblazeb2.com/research/accounting1013-(130).html
Use these as statement items, maybe in a brighter colour than the rest of the
outfit.
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/accounting20/research/accounting20-(41).html
The column silhouette skims the figure while nonetheless offering plenty of room to move.
Hello, i think that i saw you visited my website thus
i came to “return the favor”.I am trying to find things
to enhance my site!I suppose its ok to use a few of your ideas!!
Also visit my page: Chaise Lounge
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/accounting7/research/accounting7-(115).html
Following these easy tips are positive to make the method go easily and effectively.
http://accounting0014.s3-website.eu-west-3.amazonaws.com/research/accounting0014-(83).html
This includes most variations of white, similar to ivory and champagne.