I need to have some kind of similar code template so I can start to work on it.
I'm been reading some forums and did not find anything that are similar so I start to work on it. I've been struggling on how to start it.
Any help will be greatly appreciated.
Thanks,
Henry.
Below are the 2 samples input files, 1 sample output file
& pseudo code logic.
File A, input file , '~' delimiter
column heading
File B, input validation file (this is for lookup file ), '~' delimiter
column heading
I think I will have 2 loops
1st loop will be outer loop which read in the File A until eof
For each record in File A
I need to have a inner loop to perform a lookup against rows in the File B
Here are the logic to perform lookup.
Output file layout as below
'File A ' all collumns from File A ' ==> ' File B ' then all columns from File B
So the result is the 4th row from the input file A that is failed the validation
File A '5~Variant~8 ==> File B 5~Variant~12~must_match_exact~E~
Well, the problem is a classic join. The first two fields combined are a key, and the next two are the validation payload or to be validated payload. You can either put the smaller set in a string addressed array / a hash map for fast lookup, or disassemble, labeling for line #, sort both files' data by key and merge them, doing all of each validation at once. You can resort the errors by line number, and who will know!
We get this question regularly in various forms. It is important to see it as a classic join problem, just as in an RDBMS. In fact, loading/applying it all to a DRBMS tool means you can solve most of it in SQL.
Hi ,
I need an help in perl scripting.
I have an perl script written and i have an for loop in that ,where as it writes some data to a file and it has details like below.
cat out.txt
This is the first line
this is the second line.
.....Now, this file needs to be send in mail in HTML... (2 Replies)
I have been struggling to grep a file of NGrams (basically clusters of consonants or Consonant and Vowel) acting as a pattern file from an Input file which contains a long list of words, one word per line. The script would do two things:
Firstly read a text pattern from a large file of such... (5 Replies)
I have the below 2 files:
1) Third field from file1.txt should be compared to the first field of lookup.txt.
2) If match found then third field, file1.txt should be substituted with the second field from lookup.txt.
3)Else just print the line from file1.txt.
File1.txt:... (4 Replies)
Hi, I want to list all file that match user input ( specified shell wildcard) but when I compile it dont list me
#!/usr/bin/perl -w
print "Enter Advance Search Function: ";
chomp ($func = <STDIN>);
my @files = glob("$func");
foreach my $file (@files)
{
print "$file\n";... (1 Reply)
HI all,
I want to script where all the server names will be in a text file like
server1
server2
server3 . and the script should take servernames from a text file and perform copy of files if the files are not present on those servers.after which it should take next servername till the end of... (0 Replies)
Can anyone please correct the code. I am trying to copy the user input to an output file log.txt:
the script works fine but when I am trying to copy the user input error is generated.
Thanks in advance.
#!/usr/bin/perl
$temp = "/home/log.txt";
$reply = "";
print 'Enter the code:... (1 Reply)
I am reading a file using While loop
while <FILE>
{
$_ = <FILE>;
process data...
}
I would like to quit reading the file once I encounter a String pattern. How do i do it.
is it
if (/SUMMARY/)
{
last;
}
I am having problems with uninitialized value in pattern... (1 Reply)
Write a quick shell snippet to find all of the IPV4 IP addresses
in any and all of the files under /var/lib/output/*, ignoring
whatever else may be in those files. Perform a reverse lookup on
each, and format the output neatly, like "IP=192.168.0.1,
... (0 Replies)
hi
i want check for PVCS header in file if its present then check if its in proper format or not i want to do this is in perl on windows.
this is what i am doing :
1 . open file
2 . check for "PVCS information" if found then store the line no to $line var.
3 . check for "sccs" header ... (0 Replies)
In perl I want to do remove the top line of my input file then process the next line. I want to do something like
head -1 inputfile > temp
grep -v temp inputfile > newinputfile
cp newinputfile inputfle
is this possible in perl? (3 Replies)