Если этот блок текста, начинающийся с File
в вашем вопросе, является «блоком» и между каждым блоком есть пустые строки, например ::
$ cat file
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 3 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 0 232975
Other 0 716411
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 0 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 0 232975
Other 0 716411
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 0 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 1 232975
Other 0 716411
тогда это все, что вам нужно:
$ awk -v RS= -v ORS='\n\n' '($19 $36 $39 $42)+0' file
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 3 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 0 232975
Other 0 716411
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 0 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 1 232975
Other 0 716411
в противном случае, если между блоками нет пустых строк, это все, что вам нужно:
$ cat tst.awk
/^File/ { if (NR>1) prt() }
{ rec = rec $0 ORS }
END { prt() }
function prt( f) {
split(rec,f)
if ( (f[19] f[36] f[39] f[42])+0 ) {
printf "%s", rec
}
rec = ""
}
Например:
$ cat file
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 3 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 0 232975
Other 0 716411
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 0 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 0 232975
Other 0 716411
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 0 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 1 232975
Other 0 716411
.
$ cat tst.awk
/^File/ { if (NR>1) prt() }
{ rec = rec $0 ORS }
END { prt() }
function prt( f) {
split(rec,f)
if ( (f[19] f[36] f[39] f[42])+0 ) {
printf "%s", rec
}
rec = ""
}
.
$ awk -f tst.awk file
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 3 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 0 232975
Other 0 716411
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
58 OK 0 7964 1280000 8964120502
File Name: /oracle/PRD/sapdata3/sr3_55/sr3.data55
Block Type Blocks Failing Blocks Processed
---------- -------------- ----------------
Data 0 322650
Index 1 232975
Other 0 716411