Hello,
I want a script which is going to check if the numbers specified in the config file is the same for each of the types of lines in the seeding files. The script would read each line to check if the no of columns is correct as proposed in a config file. If it is not correct, out put an entire list of lines which were not correct with line number in OUTPUT file and exit with an error. If all the lines were correct, exit normally. Config.ini ROUTER,22 IF,19 QOSINTERFACE,18 Seed.csv file QOSINTERFACE,BusPhonePrefix,BusAreaCode,BusPhoneLast4 QOSINTERFACE,BusPhonePrefix,BusAreaCode,BusPhoneLast4 IF,BusPhonePrefix,BusAreaCode,BusPhoneLast4,BusAreaCode IF,BusPhonePrefix,BusAreaCode,BusPhoneLast4 QOSINTERFACE,BusPhonePrefix,BusAreaCode,BusPhoneLast4 ROUTER,BusPhonePrefix,BusAreaCode,BusPhoneLast4,BusAreaCode, QOSINTERFACE,BusPhonePrefix,BusAreaCode,BusPhoneLast4,BusAreaCode ROUTER,BusAreaCode,BusPhonePrefix,BusPhoneLast4,BusPhonePrefix, Below is the code for this particular requirement but right now inputs are hard coded I want that this script read from Config.ini file. Can anybody help me out in this? #!/usr/bin/perl $outcome = validateFile(); if($outcome == 1) {print("file is not proper, Please check the file\n");} else {print("Everything is fine in a file\n");} sub validateFile { my $state=0; $ARGV[0]=ROUTER; $ARGV[1]=5; my $first=$ARGV[0]; my $second=$ARGV[1]; my $line_num = ''; my $fname="seed.csv"; open(OF, $fname) or die "Can't open user database file!\n"; $. = 0; LINE: while ($temp_line = <OF>) { chomp $temp_line; @array = split(/,/,$temp_line,-1); #print "CURRENT LINE $temp_line\n"; if ($first eq $array[0]) { #print("$first is found\n"); [EMAIL PROTECTED]; # check particular line if($second ne $arraylength) { print "CURRENT LINE $temp_line\n"; $line_num = $.; print "LINE NUMBER $line_num\n"; print("Lenght of Current Line is $arraylength which is not matching with $second\n"); $state=1; #last; } } next LINE; } close($fname); return ($state); } Thanks, Nishant The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com