Hi,
I have attached an output file which is some kind of database file mapping. It is basically like an allocation mapping of a tablespace and its datafile/s.
The output is generated by the SQL script that I found from 401 Authorization Required
Excerpts of the file are as below:
Tablespace File Block NbBlocks Segment
---------------- ----- -------- -------- ---------------------------------------------------------------------
ABC_XYZXYZ_TXT 18 1 127
128 128 TEST.ABCD_MARTIAN_IDX
256 128 TEST.ABCD_MARTIAN_IDX
384 128
512 1024
1536 128
1664 128
...
...
...
3555712 16512
3572224 1024
3573248 24576
3597824 1024
3598848 149120
43 1 127
128 128 TEST.HEY_ARNOLD_FANS
256 128 TEST.ABC_BATMAN_ROBIN_N1
384 128
512 8
520 8
528 8
...
...
...
I have modified and rename the content but just mainly the segment name, I have put some segment name as an example.
In this example, the tablespace name is ABC_XYZXYZ_TXT and it is composed of two datafiles, file 18 and file 14. I am guessing Block 1 is the file header of each datafile hence the segment column is empty for where it is Block 1.
I'll try my best to explain what I am wanting to do. Before I go write a long script for it, I want to know first if maybe I can 'simply' use awk inside the script to search and print a range of lines above and below a given number.
For example, if I do x.ksh 3000, the script should print out something like below based on what's on testfile.txt.
ABC_XYZXYZ_TXT 18 1 127
2432 128
2560 128
2688 128
2816 128
2944 128
3072 128
3200 128
3328 128
3456 128
3584 128
3712 128
43 1 127
2560 128
2688 128
2816 128
2944 128
3072 128
3200 128
3328 128
3456 128
3584 128
3712 128
At the moment, I am thinking of reading the file one at a time and comparing the third field to the given argument that is 3000. While it seem easy to print the next 5 records > 3000, I can't think of a way of saving the last 5 that are less than 3000?
I am hoping I can get some advice on how to achieve what I am wanting to do.
Any reply much appreciated. Thanks in advance.