grep not working right with colortail
Put simply, this command won't work:
Code:
colortail /var/log/auth.log |grep -a "sshd" Code:
colortail /var/log/vsftpd.log In case you didn't know, the "-a" option in grep reads binary data as text, which is necessary for colortail's color output. I'm left to assume that the problem must lie in the difference between the two files, which is only the owner: Code:
me@ubuntu:~$ ls -l /var/log/auth.log Running Ubuntu Server 10.04 + vsftpd 2.2.2 |
Quote:
|
By "doesn't work" I mean it's not outputting anything when it should be.
The reason I think the problem is with the file owners is because thats the only difference between the files that I can tell. I am in the adm group, which makes me wonder why colortail piped to grep isn't working. |
colortail adds extra control characters to every single char of input, so that a colorized word like sshd becomes
Code:
033[1;34ms033[1;34ms033[1;34mh033[1;34md Code:
colortail -k conf.auth <(grep sshd /var/log/auth.log) |
Quote:
However, I tried that process substitution line you provided and it just output auth.log without colors, as if it was just "tail" rather than "colortail". Is there a more elegant solution, like maybe telling grep to ignore those 033[1;34m modifiers? so that rather than this... Code:
033[1;34ms033[1;34ms033[1;34mh033[1;34md Code:
sshd |
Quote:
Quote:
Code:
./colortail -k /path/to/conf.auth /var/log/auth.log | sed -r 's/^[\[[0-1]*;*[0-9]+m//g' | grep -a something |
Maybe if you explain the point of using colortail? You can have grep do a colour output of found items if this is what you are looking for.
|
Quote:
Quote:
Quote:
|
Quote:
Of course this will only colorise the expression being searched for. |
It's a shame that colortail's author never considered STDIN as
a feasible file-handle. You could always a) patch it or b) raise a feature request. Cheers, Tink |
Quote:
Quote:
Patching it is out of the question, at least for me. I've been loving linux for a year or two now and know my way around a terminal pretty well, but linux software dev is out of my realm [at least at this point in time]. |
All times are GMT -5. The time now is 01:04 AM. |