servic webservice.somthing 200 OK
servic1 webservice.somthing 200 OK
servic1 webservice.somthing 400 BAD REQEST
Below script is making tabular form perfectly. but there are two thing i am not able to achive
1.how can i color the complete row as red when it see '400' in the row, eg line 3rd from the file.
2 BAD REQUEST have space in between, and because of that BAD is coming in one column and REQUEST is coming in another, how can i get this BAD REQUEST in one column
If the line's field separator is the same as the space between the two words, you're out of luck - there's no means to tell between the two. Make sure the producing command/programme/application uses a diferent FS, e.g. a <TAB> char.
Unless the field count is known and fix - then you could count the fields and add any surplus to the status field.
Yes it is the same field that need to be checked. i mean all the lines should come in out put, but the line have 400 in it should be highlighted in red
and wont we have any alternative to fix the space issue.
like if i capture all the four parameters in variable and then can i pass all those variable in such HTML code to achive it?
How do you want to make ANYTHING that reads those lines, be it (shell) read , awk , any text utility, ..., tell the difference between the last and the before last space?
Dear Rudic,
I am not sure how we can do it, but using sed can I omit this space between BAD and REQUEST .
then i will omit the space and take the data in other file and run HTML script on that
If you say there's ONLY those two words possible - NO OTHER multi word status could come up - then of course you can do it in any tool, sed as well as awk as well as ...
Try sub (/BAD REQUEST/, "BAD_REQUEST") in above proposal.
The data in file is limited, either it is ok or bad request.
and how can I use sub (/BAD REQUEST/, "BAD_REQUEST")
you mean I have to use it in HTML code or separately on the file.
I am sorry for the confusion,
now I am getting below error
nawk: syntax error at source line 4
context is
{sub (/BAD REQUEST/, "BAD_REQUEST") >>> if <<< ($3+0 >= 400)) print "<tr style=\"color:#FF0000\">"
nawk: illegal statement at source line 4
nawk: extra ) at source line 5
extra )
---------- Post updated at 11:05 PM ---------- Previous update was at 11:01 PM ----------