

Again, that cannot be done in a plain text file just because is a plain text. So, if I got it, you want to highlight the words you searched for. Good luck! :) Highlighting the some words in the output file > output.xml, > output.html, > output.py. If you are working with other type of formats, just adapt the extension to that adjusting better for what you are greping on (e.g.
#GREP OUTPUT FILE CODE#
You don't need to color the output, the program will do it for you if it recognizes the type of code that it's opening. Which will make gedit (or any decent text editor) automatically recognize that you're talking about bash code, and will highlight it accordingly.

You may go for ls | grep something > output.sh Instead of doing something like: ls | grep something > output So the trick is to save the text output in a file with the proper extension. For example, let's say that your grep output have some bash components, so the bash highlights works for you (by the way, these are often the colors that you see in a colored output in the terminal). In spite of that there is a simple workaround, consisting in making realize your text editor what kind of file is opening. So, as far as I know, you cannot do it in an easy way. If that's the case, here are my ideas: Highlighting the output automaticallyĪs you probably know, if you capture a grep output into a text file, exactly because it is a text file it cannot be formated. If I understood correctly you want to save a terminal output in a text file, right? But you want it to be formatted with colors.
