hi,
i've many unload files with delimiter '|'. I'm trying to load them to the specific tables from those unl's. The problem here is, some unl's are corrupted. To be exact, some files doesnt seem to have the exact number of fields as in the table. So im trying to identify the corrupted files, i cant do it manually as im dealing with hundreds of such files.
I've a file with the table name(same as the file name) with the table name and the number of columns in it.
For Ex-
table1.unl
xx|xx|xxx|xxx|xx|xxx| - no of fields 6 (nt a problem)
xx|xxxx| - no of fields is 2 (report this)
xxx|xx|xx|xxxxxx| - no of fields is 4 (report this)
ref_file.txt
table1|6|
table2|10|
...
so i need a shell to check that ref_file.txt, get the number of fields in that table (which is 6 for table1) and compare it with the unl file. It has to report error when any of the row has fewer fields that that(<6 for here).
The corrupted line can be anywhere in the file, it doesnt require to be in the start. So it has to check the whole file.
Please help!
Thanks!