in reply to string format validation
One approach would be to look at every line of the file and inspect that that line matches. A Perl program to inspect a certain line of a file would be:
use strict; use Tie::File; my $f = shift; my $l = shift -1; tie my @f => 'Tie::File' => $f; print "$l: $f[$l]";
Save that program as a file and then invoke it for every line:
perl -w gfarhat.pl testfile.txt 1 perl -w gfarhat.pl testfile.txt 2 ... perl -w gfarhat.pl testfile.txt 9998
You can golf the above program into the following, if the overhead of creating a Perl program is too much for you:
perl -nle 'BEGIN{$l=pop}print if $.==$l' testfile.txt 1
|
|---|