#!/usr/bin/perl require("cgi-lib.pl"); &ReadParse; #this program does a case-insensitive search on variable names in a csv #file and reports the element number. Remeber, the element number is the #variable number minus 1The file can be .gz or .Z. You need to know the #delimiter used. #Written by Paul H. Bern 26JAN01 print "\nEnter file name: "; $f=<>; print "\nEnter values to find: "; $v=<>; chomp($v); print "\nEnter delimiter[,]: "; $d=<>; chomp($d); if($d eq "") {$d=",";} if($f =~ /gz$|Z$/i) { open(inp,"zmore $f|") or die "file not found"; $l=2; } else { open(inp,"$f") or die "file not found"; $l=1; } print "\n\n"; @v=split(/ /,$v); while () { @l=split(/$d/,$_); if ($.==$l) { $v=scalar(@l); print "Total elements: $v\n\n"; foreach $vv (@v) { for($i=0;$i<=@l;$i++) { if (@l[$i] =~ /$vv/i) { push(@col,$i); print "Search: $vv \tFound: @l[$i] \tElement: $i\n"; } } } } if($l==2 && ($.>=$l && $.<$l+1)){ print "\n\nhit cntrl-c\n\n";} } print "\n\n";