Hi,
how can i print the previous, current and next line using sed?
current line is the matching line.
The following prints all lines containing 'Failure' and also the immediate next line
cat $file | sed -n -e '/Failure/{N;p;}'
Now, i also want to print the previous line too.
Thanks,... (8 Replies)
Hello,
Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line.
i am using string as "testing"
netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h
i am able to get the previous line current line next line but... (1 Reply)
Hi guys,
I have found your forum super useful. However, right now I am stuck on a seemingly "simple" thing in AWK. I have two columns of data, the first column in Age (in million years) and the second column is Convergence Rate (in mm/yr).
I am trying to process my data so I can use it to... (2 Replies)
Hi,
I have one small doubt how to go ahead and process the below requirement.
File Content
1,abc,10
2,xyz,11
3,pqr,12
4,pqr,13
5,pqr,14
Output file expected:
1,mnq,1
1,ddd,2
1,qqq,3
1,sss,4
1,ddd,5
1,eee,6
1,fff,7
1,ddr,8
1,rrd,9 (3 Replies)
I am trying to delete lines in archived Apache httpd logs
Each line has the pattern:
<ip-address> - - <date-time> <document-request-URL> <http-response> <size-of-req'd-doc> <referring-document-URL>
This pattern is shown in the example of 6 lines from the log in the code box below. These 6... (1 Reply)
I want to remove commands having no output. In below text file.
bash-3.2$ cat abc_do_it.txt
grpg10so>show trunk group all status
grpg11so>show trunk group all status
grpg12so>show trunk group all status
GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
For example, I have a file called number.txt.
x y
1 1
2 4
3 9
4 6
5 5
6 6
7 9
8 4
9 1
10 0
...
And I want to print out the value of x and y, if y%4==0 and the next value of y%4==0. Thus, the sample output is:
1 1 *because the previous x before 2 is 1
2 4 *because 4%4 == 0
7 9... (2 Replies)
Hi everyone
I have a question for you, as I am trying to learn more about Perl and work with some weather data. I have an ascii file (shown below) that has 10 lines with different columns. What I would like is have Perl find an "anomalous" value by comparing a field with the values from the last... (2 Replies)
Hey,
I am trying to compare formated login and logout dates from one user at a host which I have stored in a tmp directory in order to find out the total login time. I need to compare them in order to find overlapping intervals.
At first I tried to store each log in and logo date in an array... (3 Replies)
Discussion started by: Mumu123
3 Replies
LEARN ABOUT DEBIAN
tau_get_event_vals
TAU_GET_EVENT_VALS(3) TAU Instrumentation API TAU_GET_EVENT_VALS(3)NAME
TAU_GET_EVENT_VALS - Gets user event data for given user events.
SYNOPSIS
C/C++:
TAU_GET_EVENT_VALS(const char **inUserEvents, int numUserEvents, int **numEvents, double **max, double **min, double **mean,
double **sumSqe);
DESCRIPTION
Retrieves user defined event data for the specified user defined events. The list of events are specified by the first parameter
(eventList) and the user specifies the number of events in the second parameter (numUserEvents). TAU returns the number of times the event
was invoked in the numUserEvents. The max, min, mean values are returned in the following parameters. TAU computes the sum of squares of
the given event and returns this value in the next argument (sumSqe).
EXAMPLE
C/C++ :
const char **eventList;
int numEvents;
TAU_GET_EVENT_NAMES(eventList, numEvents);
cout << "numEvents: " << numEvents << endl;
if (numEvents > 0) {
int *numSamples;
double *max;
double *min;
double *mean;
double *sumSqr;
TAU_GET_EVENT_VALS(eventList, numEvents, numSamples,
max, min, mean, sumSqr);
for (int i=0; i<numEvents; i++) {
cout << "-------------------
";
cout << "User Event: " << eventList[i] << endl;
cout << "Number of Samples: " << numSamples[i] << endl;
cout << "Maximum Value: " << max[i] << endl;
cout << "Minimum Value: " << min[i] << endl;
cout << "Mean Value: " << mean[i] << endl;
cout << "Sum Squared: " << sumSqr[i] << endl;
}
}
}
SEE ALSO TAU_REGISTER_EVENT(3), TAU_REGISTER_CONTEXT_EVENT(3), TAU_GET_EVENT_NAMES(3)
08/31/2005 TAU_GET_EVENT_VALS(3)