Quote:
Originally Posted by
IndigoFox
Is it possible to modify the cat command (using a linux virtual machine) so that it displays text of a file and highlights a specifically chosen word?
Despite RudiC has already come up with some rather elaborate workarounds: the short answer is you can't. The reason is (as RudiC also mentioned) that
cat is intended for a different purpose.
Your questions amounts to "can i modify a hammer so that it drills holes". Yes, maybe, somehow, but why not use a drilling machine instead, which will be better suited for that from the start?
You can use
sed as mentioned to decorate certain words or phrases with highlighting code, but that is quirky at best and certainly not very portable (chances are it won't work in the same way on another system). If you just want to search for something and want to have it easier to see the found pieces use the
grep facility. In your Linuy system the
grep has a
--color option which should do what you want. If memory serves right this is even on by default. Otherwise cosult the man page of it.
Moderator's Comments:
|
|
And, by the way: please do NOT post in the "Answers to Frequently Asked Questions" forum if you are not doing exactly that - write an essay about some frequently asked question. I have moved your thread to a more fitting forum. Thanks for your consideration.
|
|
I hope this helps.
bakunin