1

I recently learned about awk which has the simply ability to filter or output certain columns of a logfile with the print method.

Is there also an option how to suppress the output of certain columns in multitail and if yes how to do? I need it to make my logfile better readable.

sysadmin1138
  • 134,165
NES
  • 215
  • Instead of asking piecemail questions, you really should just work out of one and refine it. – gWaldo Dec 26 '10 at 14:00
  • hi, the idea of using multitail for filtering i got after asking the other question, so i couldn't include it in the other question. I like to ask the question more specific because i'm interested in learning about special techniques and do not intend to get to general answers that doesn't answer my question. i would like to know how to suppress output of certain columns in multitail, because the documentation i found on the web doesn't help me much. i found that there 's an option -kc x y to suppress one column, but i doesn't succeed to define several columns to hide in multitail? – NES Dec 26 '10 at 14:16

2 Answers2

5

You can use -kc x y to strip column y as delimited by x. You can use -kc multiple times too.

e.g. a line from an apache access log

89.149.244.193 - - [26/Dec/2010:10:50:52 +0000] "GET /admin/config.php HTTP/1.1" 404 495 "-" "Python-urllib/2.4"

and the same thing once it's been through -kc " " 1 -kc " " 2 -kc " " 3 -kc " " 4

89.149.244.193 "GET /admin/config.php HTTP/1.1" 404 495 "-" "Python-urllib/2.4"
user9517
  • 116,228
  • thanks, i tried it with this command: multitail -kc 1 " " logfile.log. the columns in my logfile are delimited by whitespaces, is this the right syntax i use with whitespace in doublequotes, because i don't really understand what multitail expects to be a column. it seems not very similar to that was awk defines as a column? – NES Dec 26 '10 at 14:35
  • @NES: You have the delimiter and column number the wrong way around. I added an example. – user9517 Dec 26 '10 at 14:38
1

cat myfile | awk '{print $1 $2 ...}'

where $1 $2 are the columns you want to see, the rest will not show up is this what you want ?

silviud
  • 2,707
  • not exactly. i'm searching for an option to do this with multitail because of it's features it seems to be very suitable for logfile analysis. – NES Dec 26 '10 at 14:21