...the index of the row and column where the data is missing...
output:#!/bin/perl5 use strict; use warnings; use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1; # two passes # first, load the db my @db; while (my $rec = <DATA>){ my @flds = unpack qq{A10xA14xA7xA5xA6xA6}, $rec; push @db, \@flds; } # second, iterate over it for my $i (0..$#db){ # each row my @row = @{$db[$i]}; for my $j (0..$#{@row}){ # each field if (not $row[$j]){ printf qq{row: %s col: %s is missing\n}, $i+1, $j+1;; } } } # a field has been removed from each of the last two records __DATA__ maps_c7 190_520 3195927 00 40 0K8632 maps_c7 210_520 3195928 00 41 0K8701 maps_c7 210_620 3195929 00 42 0K8702 maps_c7 230_560 3195930 00 43 0K8635 maps_c7 230_620 3195931 00 44 0K8703 maps_c7 230_660 3195932 00 45 0K8704 maps_c7 250_660 3195933 00 46 0K8638 maps_c7 250_800 3195934 00 47 0K8705 maps_c7 275_800 3195935 00 48 0K8640 maps_c7 300_860 3195936 00 49 0K8706 maps_c7 300_860_ER 3195937 00 50 0K8642 maps_c7 330_860_ER 3195938 00 51 0K8643 maps_c7 350_860_ER 3195939 00 52 0K8707 maps_c7 300_860_RV 3195940 00 53 0K8645 maps_c7 330_860_RV 3195941 00 54 0K8646 maps_c7 3195942 00 55 0K8647 maps_c7 360_925_RV 00 56 0K9048
row: 16 col: 2 is missing row: 17 col: 3 is missing
...or corrupt...For this you will need a set of regexes to define what the fields should contain/look like. You would then validate each field against each regex.
hth
In reply to Re^3: Reading a file as an multi dimensional array Please help
by wfsp
in thread Reading a file as an multi dimensional array Please help
by sas429s
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |