I have an issue which I been trying to solve.
In this program I am basically looking at files and making sure they look alike. If there is any difference from the file to the record it will get tossed in a hold directory (i.e File=TOVVRIDE1234, record=TOVRRIDE1235). Because of this difference it gets tossed.
My dilemma is this; I will get a file called TOVVRIDE1234.1 and the records within are TOVRRIDE1234 Now because the file says .1 at the end it is sending it to the hold directory. I want to accept files with a .1, .2, etc.. What's happening is that the program looks at the record and will see the TOVVRIDE1234, than look at the file and see TOVRRIDE1234.1 which says "Hey lets toss this one" ANy idea on how to accept files with a .1, .2, etc?
#! /usr/bin/awk
##############################################################################
# This program will verify the store number in 'office' which
# matches the store number in the file. Beginning at character
# #3 - 8 it will verify store numbers are the same. Store number
# with four characters will be padded with a zero which also gets
# trapped. In any case, if there is a corrput record or file, it
# goes into a hold directory with a timestamp associated.
#
###############################################################################
BEGIN {
if (substr(ARGV[1],0,3) != "TOV"
{
office = substr(ARGV[1],7);
}
else {
office = substr(ARGV[1],9);
}
}
{
sys_call = "mv " ARGV[1] " /rec/timework/timehold/" ARGV[1] ".`date '+%j%H%M%S'`";
# sys_call = "mv " FILENAME " /usr/acct/acmmgr/hold/" FILENAME ".`date '+%j%H%M%S'`";
############################################################################
# This is where we read the character(s) checking to see if there is a
# zero and if it is a mirror image of the office validaion. If not,
# than sys_call is set to move the record into the hold directory.
############################################################################
if (substr($0,3,1) == "0"
{
if (substr($0,4,4) != office) {
system(sys_call);
exit(0);
}
}
else {
if (substr($0,3,5) != office) {
system(sys_call);
exit(0);
}
}
if (substr($0,3,5) != office) {
system(sys_call);
}
}
In this program I am basically looking at files and making sure they look alike. If there is any difference from the file to the record it will get tossed in a hold directory (i.e File=TOVVRIDE1234, record=TOVRRIDE1235). Because of this difference it gets tossed.
My dilemma is this; I will get a file called TOVVRIDE1234.1 and the records within are TOVRRIDE1234 Now because the file says .1 at the end it is sending it to the hold directory. I want to accept files with a .1, .2, etc.. What's happening is that the program looks at the record and will see the TOVVRIDE1234, than look at the file and see TOVRRIDE1234.1 which says "Hey lets toss this one" ANy idea on how to accept files with a .1, .2, etc?
#! /usr/bin/awk
##############################################################################
# This program will verify the store number in 'office' which
# matches the store number in the file. Beginning at character
# #3 - 8 it will verify store numbers are the same. Store number
# with four characters will be padded with a zero which also gets
# trapped. In any case, if there is a corrput record or file, it
# goes into a hold directory with a timestamp associated.
#
###############################################################################
BEGIN {
if (substr(ARGV[1],0,3) != "TOV"
office = substr(ARGV[1],7);
}
else {
office = substr(ARGV[1],9);
}
}
{
sys_call = "mv " ARGV[1] " /rec/timework/timehold/" ARGV[1] ".`date '+%j%H%M%S'`";
# sys_call = "mv " FILENAME " /usr/acct/acmmgr/hold/" FILENAME ".`date '+%j%H%M%S'`";
############################################################################
# This is where we read the character(s) checking to see if there is a
# zero and if it is a mirror image of the office validaion. If not,
# than sys_call is set to move the record into the hold directory.
############################################################################
if (substr($0,3,1) == "0"
if (substr($0,4,4) != office) {
system(sys_call);
exit(0);
}
}
else {
if (substr($0,3,5) != office) {
system(sys_call);
exit(0);
}
}
if (substr($0,3,5) != office) {
system(sys_call);
}
}