Perfect ! Both commands are working perfect for the example that I posted. \
But it is not working if I change the script to my actual.
Some useful points about my real logs..
1. Responses can have some names like ListABCRes, ABCRes, DDARes, etc..
where in example log I gave you response1,response2 etc ..
To get ListABCRes, I changed your command as below
I am getting the error like below
So, I thought I should need to filter something and so I changed like below
it is still having the same error.
Responses are big and There are too many responses for one user and too many same responses for different users say for example many users can have ListABCRes response and one user can have ListABCRes in the logs many times.
So do you suggest anything on this ?
Last edited by nariwithu; 01-20-2012 at 05:17 PM..
You did not modify Scrutinizer's code well. His code was as follows:
This is setting a variable 'resp' to have the value 'response2', and variable 'user' to a string 'user1'. Do not change the code inside the single quotes, just change the "response2" to what is your response actually named. If you are hunting a section
, with user "user1", then you'd do:
However, I don't see why you would be getting "record too long" error... the code is appending to an internal variable. Have you tried to preprocess the file with the sed command and then pipe it to awk as suggested before?
It is still getting me record too long exception with the following code as you suggested.
I tried to preprocess with sed , then also it is giving me the same exception
getting same error with the following code also
I am again noting that one user can have two or more ListABCResp in the logs, Logs can be big, Response can be big and Many users can have ListABCResp responses. Similarly other responses also.
I have no clue how to proceed. Hope you will help me again.
I recommend getting GNU awk, it may prove useful in the future also. You can download it from here: ftp://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz
and then standard build:
If you don't have the privilege to install it system wide, just install it in a non-standard directory: ---------- Post updated at 06:54 PM ---------- Previous update was at 06:34 PM ----------
Downloaded gawk-3.1.8.tar.gz Extracted in windows machine as tar was not working for me. uploaded the extracted gawk-3.1.8 folder to my directory in unix machine. ran the command ./configure make make install
I am getting the following error while installing.
Quote:
Do you have perl?
I have perl installed. When I ran your suggested perl code by modifying like below, I am getting the following error.
This is not correct. These are three steps; you have to run them one at a time:
then
then
As for the garbled command... hmm... interesting. It is working ok, with my version of sed. Please post the output of
And try to take out the spaces and add a semicolon. Like this:
If that still comes out as garbled, try to put the commands one per line: ---------- Post updated at 03:26 AM ---------- Previous update was at 03:05 AM ----------
Although my perl skills are not very developed at all, I wrote a pure perl script; give this a try:
Hi, i have file file.txt with data like:
START
03:11:30 a
03:11:40 b
END
START
03:13:30 eee
03:13:35 fff
END
jjjjjjjjjjjjjjjjjjjjj
START
03:14:30 eee
03:15:30 fff
END
ggggggggggg
iiiiiiiiiiiiiiiiiiiiiiiii
I want the below output
START (13 Replies)
Hi all,
I have an input file as below. I would like to count the occurrence of pattern matching 8th field for each line.
Input:
field_01 field_02 field_03 field_04 field_05 field_06 field_07 field_08
TA T TA T TA TA TA... (3 Replies)
Assume a string that contains one or multiple occurrences of three different keywords (abbreviated as "kw"). I would like to replace kw2 with some other string, say "qux". Specifically, I would like to replace that occurrence of kw2 that is the first one that is preceded by kw1 somewhere in the... (4 Replies)
HPUX /bin/sh (posix)
I have a file as such
cat dog mouse
deer elk rabbit
mouse rat pig
I would like to replace the second occurrence of mouse in this file with mouse2. The rest of the file has to stay exactly as is. I'm not sure exactly where mouse might be (could be first,second,third... (5 Replies)