Would you please help me on formatting the following lines of information.
Input file:
-- appl = host = user = / pid = 76 elapsed = 0.000 seconds server_elapsed = 0.000 [ one line only]
select emp_no, dept_no
from emp
where empname like 'Rob%'
;
-- appl = host = user = / pid = 76 elapsed = 0.000 seconds server_elapsed = 0.999 [ one line only]
select emp_no, dept_no
from dept
where deptname like 'IT%'
;
Output need to have all lines where server_elapsed >0.100 like below
server_elapsed=0.999 |select emp_no, dept_no from dept where deptname like 'IT%' ; [One line only]
Thanks for your help madhan. It is working fine. But I found some lines with more feilds in the first line and $7 is not validating.
For this I modified the code to
firststring=`awk -F"server_elapsed = " '/server_elapsed/ { if( $2 > 0.100 ) { print "server_elapsed="$2"|"} }' tran.log`
and the above line is working fine.
But the issue with number lines in the select statement they are not constant i.e 4.
Thanks for your help on printing the input text matrixmadhan.
But I need help on multiple lines if they condition met.
-- appl = host = user = / pid = 76 elapsed = 0.000 seconds server_elapsed = 2.999
select emp_no, dept_no
from emp
where empname like 'Rob%'
;
-- appl = host = user = / pid = 76 elapsed = 0.000 seconds server_elapsed = 0.999
select emp_no, dept_no
from dept
where deptname like 'IT%'
;
As per the above input, there will be two output lines.
server_elapsed= 0.999 |select emp_no, dept_no from dept where deptname like 'IT%' ;
server_elapsed= 2.999 |select emp_no, dept_no from emp where empname like 'Rob%';
Thanks for your help madhan. It is working fine. But I found some lines with more feilds in the first line and $7 is not validating.
For this I modified the code to
firststring=`awk -F"server_elapsed = " '/server_elapsed/ { if( $2 > 0.100 ) { print "server_elapsed="$2"|"} }' tran.log`
and the above line is working fine.
But the issue with number lines in the select statement they are not constant i.e 4.
I am getting the following error, would you please help me on this.
Syntax Error The source line is 1.
The error context is
BEGIN{} { if(NR > >>> 1 <<<
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.
awk: 0602-540 There is a missing } character.
awk: 0602-540 There is a missing ) character.
Hello,
I have 3 columns like shown below:
1 1800 1900
2 1765 1900
3 1654 2054
4 1326 1499
5 1540 1765
I want only those rows where column 2 and column 3's values don't fall within 1800-1900 both inclusive.
My output should only be:
4 1326 1499
5 1540 1765
Is there a quick awk... (3 Replies)
Hi,
I have the following input in a file & need output as mentioned below(need counter of every occurance of field which is to be increased by 1).
Input:
919143110065
919143110065
919143110052
918648846132
919143110012
918648873782
919143110152
919143110152
919143110152... (2 Replies)
Actually I got a list of file end with *.txt
I want to use the same command apply to all the *.txt
Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics.
For example:
I got the file below:
file1.txt
file2.txt
file3.txt... (4 Replies)
The line is simple, use " '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }'
I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ".
Thanks. (2 Replies)
Can anybody please supply me with a good url to get online help to awk programming, with good examples.
Yes I've taken that big step in trying to master 'awk' after being able to avoid it for the last couple of years :-)
Failing that, is there any good books I can get instead.
Many thanks... (4 Replies)