AT
----------
0
Elapsed: 00:00:00.02
SO
----------
0
Elapsed: 00:00:00.01
SE
----------
0
Elapsed: 00:00:00.01
CR
----------
15612
Elapsed: 00:00:00.00
How to read the contents of the file and tell that which data is 0.
For example, I have SO and SE as 0, how to echo "SO and SE" has as 0
Something like this?
awk '/--/{getline;if(!int($0)){print s $0}}{s=$1}' file
ripat
3
Or...
awk '$0==0{print f}/[A-Z][A-Z]/{f=$0}' f
awk '/--/{getline;if(!int($0)){print s $0}}{s=$1}' {$outputfile}
Can anyone please expain me this line.
Explanation:
/--/{getline;if(!int($0)){print s $0}}
If the line contains "--" then get the next line.
If the value of the next line is not 0 print the line before the line with "--"
{s=$1}
Assign the line to the variable s, if the current line contains "--" the value is always the line before this line.