Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are a Linux Engineer working in the backend development team for a local com

ID: 2246686 • Letter: Y

Question

You are a Linux Engineer working in the backend development team for a local company.

Each day a list of files requiring processing is received everyday via email. The list is saved into a file calledfoop.in (provided).

The list must be partitioned and send to different units. For example, the list of payroll related files must be sent to Accounting, the list of files with wrong naming convention must be sent to Processing, etc.

Below are the different categories:

Billing and Payment files (arch_files)

These are:

All the files in the directories “opeiu-sftp” and “seanc-sftp”

files in the directory

“triad-152-sftp” that contain the keyword “_Terms_”

“acs-sftp” that starts with “DeductionRequest_”

“salem5-sftp” that starts with “SalemFive_” or “SalemFiveBenefits_”

“harris-1462-sftp” that contains “_DeductionReport_”

“bestbuy-1369-sftp” that contains “_DeductionRegister_”

“Sheridan-679-sftp” that contains “Billing” (or billing)

“cmh-667-sftp” that contains “DedReg_”

“Trustmark-1003-sftp” named simply as a string of numbers followed by “.FIL”, such as 00000252.FIL.pgp

Eligibility files (elig_files)

These are

all files that contain the keyword “_Eligibility_” in their name

Files in “emory-1410-sftp” that contain the keyword “Eligibility_” in their name

Naming convention files (name_files)

These are files not named properly. They are:

Filenames with uppercase extension such as “.GPG” or “.PGP”

Filenames that contain space(s)

Files in directory “mercer-sftp” that start with “LifeSpace_” and do not have an underscore after the keyword “_CAD”

Files in directory “acs-sftp” that start with “L3Comm_” and do not have an underscore after the keyword “_CAD”

Files in directory “acs-sftp” that start with “ADT_” and do not have the keyword “_FULL_” between “InfoArmor” and the date.

Files in the directory “adp-sftp” that start with “TomraofNorthAmerica_” and do not have the keyword “_CAD_” between “InfoArmor” and the date.

Files in the directory “aon-197-sftp” that start with “ResCare_” and do not have the keyword “_CAD_” between “InfoArmor” and the date.

Files in the directory “bhsi-1520-sftp” that starts with “bhsky_” instead of “Bhsky_”

Files in directory “adp-818-sftp” that start with “Dassault” and do not have an underscore after the keyword “_Full”

Decryption (decrypt_files)

These are files from directory “marsh-sftp” that starts with “Consecutive_Missed_Deductions_”

Conversion files (conv_files)

These are files with keywords “_CONV_” or “_CON_” in their name

Disney files (disney_files)

These are files from directory “fidelity-1476-sftp” whose filenames start with keywords “DISN_To_InfoArmor_”

Gates files (gate_files)

These are files from directory “paylogix-sftp” whose filenames start with keywords “GatesFoundation_To_InfoArmor_”

NOTE:

Note that the full pathname to a directory such as “triad-152-sftp” is listed as

A file cannot belong to multiple categories. If a file falls into a category, then it CANNOT be considered for any subsequent category. For example, because seanc-sftp files are Billing and Payment files, the file /home/seanc-sftp/home/seanc-sftp/inbound/SEANC_To_InfoArmor_Eligibility_File_20170630.csv.gpg will not be part of the Eligibility files.

The categories are listed in order of priority

Submissions

You are to submit (4) files:

foop_prep.sh

foop.out

foop_partition.sh

A zip of the following files: arch_files, elig_files, name_files, decrypt_files, conv_files, diney_files, gate_files, and noclass_files

Note that some output files may not be created if there is no corresponding entry in the input file provided. In that case, you need not submit it. However, your script will be run against different test cases. So make sure your logic is correct, and modify the input file as needed to check all the possibilities.

Part I: Pre-processing

Your first task is to write a script called foop_prep.sh that pre-processes the file foop.in so that:

Each line of the file represents an absolute pathname to a file of interest.

For example:

the line

file found: /home/jbssa-sftp/home/jbssa-sftp/jbssa-sftp/inbound/JBS_To_InfoArmor.csv.pgp

must become

/home/jbssa-sftp/home/jbssa-sftp/jbssa-sftp/inbound/JBS_To_InfoArmor.csv.pgp

the line

>Checking for unknown file types in inbound

must be removed as it does not represent a pathname of a file

Your script should output a file called foop.out that is similar to the template foop_out.doxc provided. To run your script, the file foop.in must be provided as argument

Your script must first delete, if present, any previous foop.out file

Part II: Partitioning

Your second task is to write a script, called foop_partition.sh, that takes as input foop.out and creates the following files per the rules described in the Introduction: arch_files, elig_files, name_files, decrypt_files, conv_files, disney_files, gate_files, and noclass_files (files that do not fall in any of the categories listed).

Your script must first delete, if present, any previous partition name (arch_files, elig_files, etc.)

FOOP.OUT file contents

/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_06302017_040041.csv.pgp

/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_06302017_040041.csv.pgp

/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07142017_040109.csv.pgp

/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07142017_040109.csv.pgp

/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07282017_040018.csv.pgp

/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07282017_040018.csv.pgp

/home/benefitexpress-270-sftp/home/benefitexpress-270-sftp/inbound/Hamilton_To_InfoArmor_CON_20170719.csv.pgp

/home/benefitwerks-1157-sftp/home/benefitwerks-1157-sftp/inbound/NN_To_InfoArmor_CAD_20170802.csv.GPG

/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170725.csv.pgp

/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170725.csv.pgp

/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170801.csv.pgp

/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170801.csv.pgp

/home/bfocus-sftp/home/bfocus-sftp/inbound/CME_To_InfoArmor_PhoneNumber_20170718.csv.pgp

/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170519_20170615.csv.gpg

/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170519_20170615.csv.gpg

/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170616_20170727.csv.gpg

/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170616_20170727.csv.gpg

/home/emory-1410-sftp/home/emory-1410-sftp/inbound/EmoryEligibility_To_InfoArmor_20170731.csv_

/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707260806319.csv

/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707260806319.csv

/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707270600274.csv

/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707270600274.csv

/home/hartfiel-1491-sftp/home/hartfiel-1491-sftp/Hartfiel_To_InfoArmor_TEST_CAD_201708020519.csv.pgp

/home/jbssa-sftp/home/jbssa-sftp/jbssa-sftp/inbound/JBS_To_InfoArmor.csv.pgp

/home/jbssa-sftp/home/jbssa-sftp/jbssa-sftp/inbound/JBS_To_InfoArmor.csv.pgp

/home/jbssa-sftp/home/jbssa-sftp/ppride-sftp/inbound/PPC_To_InfoArmor.csv.pgp

/home/jbssa-sftp/home/jbssa-sftp/ppride-sftp/inbound/PPC_To_InfoArmor.csv.pgp

/home/kar-sftp/home/kar-sftp/inbound/InfoArmor_July_2017.xlsx

/home/kar-sftp/home/kar-sftp/inbound/InfoArmor_July_2017.xlsx

/home/kar-sftp/home/kar-sftp/inbound/InfoArmor_June_2017.xlsx

/home/kar-sftp/home/kar-sftp/inbound/InfoArmor_June_2017.xlsx

/home/marsh-sftp/home/marsh-sftp/inbound/Consecutive_Missed_Deductions_20170727.csv.pgp

/home/marsh-sftp/home/marsh-sftp/inbound/Consecutive_Missed_Deductions_20170727.csv.pgp

/home/marsh-sftp/home/marsh-sftp/inbound/Consecutive_Missed_Deductions_20170803.csv.pgp

/home/nov-983-sftp/home/nov-983-sftp/inbound/Novartis_To_InfoArmor_Eligibility_20170728.csv.pgp

/home/oeb-1165-sftp/home/oeb-1165-sftp/inbound/OEB_To_InfoArmor_Eligibility_20170721.csv.pgp

/home/oeb-1165-sftp/home/oeb-1165-sftp/inbound/OEB_To_InfoArmor_Eligibility_20170728.csv.pgp

/home/opeiu-sftp/home/opeiu-sftp/OPEIU_To_InfoArmor_CAD_20170701.csv.gpg_

/home/opeiu-sftp/home/opeiu-sftp/OPEIU_To_InfoArmor_CAD_20170801.csv.gpg

/home/paylogix-sftp/home/paylogix-sftp/Paylogix_To_InfoArmor_CAD_20170720.csv.pgp

/home/paylogix-sftp/home/paylogix-sftp/Paylogix_To_InfoArmor_CAD_20170721.csv.pgp

/home/salem5-sftp/home/salem5-sftp/inbound/SalemFiveBenefits_To_InfoArmor.20170804.csv.gpg

/home/salem5-sftp/home/salem5-sftp/inbound/SalemFive_To_InfoArmor.20170804.csv.gpg

/home/seanc-sftp/home/seanc-sftp/inbound/SEANC_To_InfoArmor_Eligibility_File_20170630.csv.gpg

/home/seanc-sftp/home/seanc-sftp/inbound/SEANC_To_InfoArmor_Eligibility_File_20170731.csv.gpg

/home/smartb-sftp/home/smartb-sftp/inbound/LRG_To_InfoArmor_CONV_20170607.csv.pgp.pgp

/home/smartb-sftp/home/smartb-sftp/inbound/LRG_To_InfoArmor_CONV_20170607.csv.pgp.pgp

/home/spgi-1490-sftp/home/spgi-1490-sftp/inbound/SPGI_To_InfoArmor_Eligibility_20170728.csv.pgp

/home/telesoft-1828-sftp/home/telesoft-1828-sftp/inbound/test.txt

/home/telesoft-1828-sftp/home/telesoft-1828-sftp/inbound/test.txt

/home/tpadv-sftp/home/tpadv-sftp/inbound/TripAdvisor_To_InfoArmor_Eligibility_20170802.csv.pgp

/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor_Terms_20170701.xls.pgp

/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor_Terms_20170701.xls.pgp

/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor_Terms_20170801.xls.pgp

/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor_Terms_20170801.xls.pgp

/home/Trustmark-1003-sftp/home/Trustmark-1003-sftp/inbound/00000252.FIL.pgp

/home/Trustmark-1003-sftp/home/Trustmark-1003-sftp/inbound/00000252.FIL.pgp

/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07172017.txt

/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07172017.txt

/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07202017.txt

/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07202017.txt_

/home/wyle-428-sftp/home/wyle-428-sftp/inbound/Wyle_To_InfoArmor_CONV_20170713.csv.pgp

/home/wyle-428-sftp/home/wyle-428-sftp/inbound/Wyle_To_InfoArmor_CONV_20170713.csv.pgp

FOOP.IN CONTENTS

Explanation / Answer

Answer:

Preprocessing: foop_prep.sh

------------------------------------------------------

#foop preprocessing script file
#Note: To run this script: bash ./foop_prep.sh foop.in
#Alernatively: sh ./foop_prep.sh foop.in
#But for this to work, uncomment statements marked for sh and comment statements marked for bash

#Input file name
INPUT_FILE=$1
#Output file name
OUTPUT_FILE="foop.out"
#extacted path of file
FILEPATH=""
#pattern to look for
PATTERN="file found:"

#PATTERN_LENGTH=$(echo $PATTERN|wc -c) #works with sh
PATTERN_LENGTH=${#PATTERN} #works with bash

#echo "File: $INPUT_FILE" #for testing

#remove output file if already existing
clear
rm -f $OUTPUT_FILE > /dev/null

#read file line by line
while read -r LINE
do
   LINE_TEXT=$LINE
   #LINE_LENGTH=$(echo $LINE_TEXT|wc -c) #works with sh
   case $LINE_TEXT in
       *"file found:"*)
            #PATH_LENGTH=$LINE_LENGTH - $PATTERN_LENGTH > /dev/null #works with sh
           #FILEPATH=$(echo $LINE_TEXT|cut -c $PATTERN_LENGTH-$PATH_LENGTH) #works with sh
           FILEPATH=${LINE_TEXT:$PATTERN_LENGTH} #works with bash
           echo $FILEPATH >> $OUTPUT_FILE
           ;;
       #*) echo "else";; #for testing
   esac
done < $INPUT_FILE

-----------------------------------------

foop.out:

------------------------------------------

/home/hartfiel-1491-sftp/home/hartfiel-1491-sftp/Hartfiel_To_InfoArmor_TEST_CAD_201708020519.csv.pgp
/home/hartfiel-1491-sftp/home/hartfiel-1491-sftp/Hartfiel_To_InfoArmor_TEST_CAD_201707170412.csv.pgp
/home/paylogix-sftp/home/paylogix-sftp/GatesFoundation_To_InfoArmor_CAD_20170802.csv.pgp
/home/paylogix-sftp/home/paylogix-sftp/Paylogix_To_InfoArmor_CAD_20170720.csv.pgp
/home/paylogix-sftp/home/paylogix-sftp/GatesFoundation_To_InfoArmor_CAD_20170726.csv.pgp
/home/paylogix-sftp/home/paylogix-sftp/Paylogix_To_InfoArmor_CAD_20170721.csv.pgp
/home/opeiu-sftp/home/opeiu-sftp/OPEIU_To_InfoArmor_CAD_20170801.csv.gpg
/home/opeiu-sftp/home/opeiu-sftp/OPEIU_To_InfoArmor_CAD_20170701.csv.gpg
/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707260806319.csv
/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707270600274.csv
/home/jbssa-sftp/home/jbssa-sftp/jbssa-sftp/inbound/JBS_To_InfoArmor.csv.pgp
/home/jbssa-sftp/home/jbssa-sftp/ppride-sftp/inbound/PPC_To_InfoArmor.csv.pgp
/home/marsh-sftp/home/marsh-sftp/inbound/Consecutive_Missed_Deductions_20170727.csv.pgp
/home/marsh-sftp/home/marsh-sftp/inbound/Consecutive_Missed_Deductions_20170803.csv.pgp
/home/smartb-sftp/home/smartb-sftp/inbound/LRG_To_InfoArmor_CONV_20170607.csv.pgp.pgp
/home/Trustmark-1003-sftp/home/Trustmark-1003-sftp/inbound/00000252.FIL.pgp
/home/salem5-sftp/home/salem5-sftp/inbound/SalemFiveBenefits_To InfoArmor.20170804.csv.gpg
/home/salem5-sftp/home/salem5-sftp/inbound/SalemFive_To_InfoArmor.20170804.csv.gpg
/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170725.csv.pgp
/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170801.csv.pgp
/home/kar-sftp/home/kar-sftp/inbound/InfoArmor July 2017.xlsx
/home/kar-sftp/home/kar-sftp/inbound/InfoArmor June 2017.xlsx
/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07282017_040018.csv.pgp
/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_06302017_040041.csv.pgp
/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07142017_040109.csv.pgp
/home/telesoft-1828-sftp/home/telesoft-1828-sftp/inbound/test.txt
/home/wyle-428-sftp/home/wyle-428-sftp/inbound/Wyle_To_InfoArmor_CONV_20170713.csv.pgp
/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170616_20170727.csv.gpg
/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170519_20170615.csv.gpg
/home/bfocus-sftp/home/bfocus-sftp/inbound/CME_To_InfoArmor_PhoneNumber_20170718.csv.pgp
/home/benefitexpress-270-sftp/home/benefitexpress-270-sftp/inbound/Hamilton_To_InfoArmor_CON_20170719.csv.pgp
/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor_Terms_20170701.xls.pgp
/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor Terms_20170801.xls.pgp
/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07172017.txt
/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07202017.txt
/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707260806319.csv
/home/harris-1462-sftp/home/harris-1462-sftp/inbound/HarrisCorporation_To_InfoArmor_DeductionReport_201707270600274.csv
/home/jbssa-sftp/home/jbssa-sftp/jbssa-sftp/inbound/JBS_To_InfoArmor.csv.pgp
/home/jbssa-sftp/home/jbssa-sftp/ppride-sftp/inbound/PPC_To_InfoArmor.csv.pgp
/home/marsh-sftp/home/marsh-sftp/inbound/Consecutive_Missed_Deductions_20170727.csv.pgp
/home/smartb-sftp/home/smartb-sftp/inbound/LRG_To_InfoArmor_CONV_20170607.csv.pgp.pgp
/home/Trustmark-1003-sftp/home/Trustmark-1003-sftp/inbound/00000252.FIL.pgp
/home/nov-983-sftp/home/nov-983-sftp/inbound/Novartis_To_InfoArmor_Eligibility_20170728.csv.pgp
/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170725.csv.pgp
/home/bestbuy-1369-sftp/home/bestbuy-1369-sftp/inbound/BestBuy_To_InfoArmor_DeductionRegister_20170801.csv.pgp
/home/kar-sftp/home/kar-sftp/inbound/InfoArmor July 2017.xlsx
/home/kar-sftp/home/kar-sftp/inbound/InfoArmor June 2017.xlsx
/home/spgi-1490-sftp/home/spgi-1490-sftp/inbound/SPGI_To_InfoArmor_Eligibility_20170728.csv.pgp
/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07282017_040018.csv.pgp
/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_06302017_040041.csv.pgp
/home/acs-sftp/home/acs-sftp/inbound/DeductionRequest_07142017_040109.csv.pgp
/home/telesoft-1828-sftp/home/telesoft-1828-sftp/inbound/test.txt
/home/wyle-428-sftp/home/wyle-428-sftp/inbound/Wyle_To_InfoArmor_CONV_20170713.csv.pgp
/home/tpadv-sftp/home/tpadv-sftp/inbound/TripAdvisor_To_InfoArmor_Eligibility_20170802.csv.pgp
/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170616_20170727.csv.gpg
/home/cmh-667-sftp/home/cmh-667-sftp/inbound/InfoArmorDedReg_20170519_20170615.csv.gpg
/home/bfocus-sftp/home/bfocus-sftp/inbound/CME_To_InfoArmor_PhoneNumber_20170718.csv.pgp
/home/benefitexpress-270-sftp/home/benefitexpress-270-sftp/inbound/Hamilton_To_InfoArmor_CON_20170719.csv.pgp
/home/seanc-sftp/home/seanc-sftp/inbound/SEANC_To_InfoArmor_Eligibility_File_20170731.csv.gpg
/home/seanc-sftp/home/seanc-sftp/inbound/SEANC_To_InfoArmor_Eligibility_File_20170630.csv.gpg
/home/oeb-1165-sftp/home/oeb-1165-sftp/inbound/OEB_To_InfoArmor_Eligibility_20170728.csv.pgp
/home/oeb-1165-sftp/home/oeb-1165-sftp/inbound/OEB_To_InfoArmor_Eligibility_20170721.csv.pgp
/home/employeenavigator-1747-sftp/home/employeenavigator-1747-sftp/inbound/EmployeeNavigatorTest_20170801144206.txt
/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor_Terms_20170701.xls.pgp
/home/triad-152-sftp/home/triad-152-sftp/inbound/InfoArmor_Terms_20170801.xls.pgp
/home/benefitwerks-1157-sftp/home/benefitwerks-1157-sftp/inbound/NN_To_InfoArmor_CAD_20170802.csv.GPG
/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07172017.txt
/home/unum-1547-sftp/home/unum-1547-sftp/inbound/CorizonCensus_07202017.txt
/home/emory-1410-sftp/home/emory-1410-sftp/inbound/EmoryEligibility_To_InfoArmor_20170731.csv

----------------------------------------------

foop_partition.sh:

-----------------------------------------------

#foop partitioning script file

#Input file name
INPUT_FILE=$1

#Output files
ARCH_FILES="arch_files" #Arch file
ELIG_FILES="elig_files" #Elig file
NAME_FILES="name_files" #Name file
DECRYPT_FILES="decrypt_files" #Decrypy file
CONV_FILES="conv_files" #Conv file
DISNEY_FILES="disney_files" #Disney file
GATE_FILES="gate_files" #Gate file
NOCLASS_FILES="noclass_files" #No Class file

#remove output files if already existing
clear
rm -f $ARCH_FILES > /dev/null
rm -f $ELIG_FILES > /dev/null
rm -f $NAME_FILES > /dev/null
rm -f $DECRYPT_FILES > /dev/null
rm -f $CONV_FILES > /dev/null
rm -f $DISNEY_FILES > /dev/null
rm -f $GATE_FILES > /dev/null
rm -f $NOCLASS_FILES > /dev/null


#Patterns to search
ARCH_PATTERN1="opeiu-sftp"
ARCH_PATTERN2="seanc-sftp"
ARCH_PATTERN3="triad-152-sftp"
ARCH_PATTERN4="acs-sftp"
ARCH_PATTERN5="salem5-sftp"
ARCH_PATTERN6="harris-1462-sftp"
ARCH_PATTERN7="bestbuy-1369-sftp"
ARCH_PATTERN8="Sheridan-679-sftp"
ARCH_PATTERN9="cmh-667-sftp"
ARCH_PATTERN10="Trustmark-1003-sftp"
ELIG_PATTERN1="_Eligibility_"
ELIG_PATTERN2="emory_1410_sftp"
NAME_PATTERN1=".GPG"
NAME_PATTERN2=".PGP"
NAME_PATTERN3=" "
NAME_PATTERN4="mercer-sftp"
NAME_PATTERN4="acs-ftp"
NAME_PATTERN6="adp-sftp"
NAME_PATTERN7="aon-197-sftp"
NAME_PATTERN8="bhsi-1520-sftp"
NAME_PATTERN9="adp-818-sftp"
DECRYPT_PATTERN="marsh-sftp"
CONV_PATTERN1="_CONV_"
CONV_PATTERN2="_CON_"
DISNEY_PATTERN="fidelity-1476-sftp"
GATE_PATTERN="paylogix-sftp"

#read file line by line
while read -r LINE
do
   LINE_TEXT=$LINE
   case $LINE_TEXT in
       *$ARCH_PATTERN1*)
           echo $LINE_TEXT >> $ARCH_FILES
           ;;
       *$ARCH_PATTERN2*)
           echo $LINE_TEXT >> $ARCH_FILES
           ;;
       *$ARCH_PATTERN3*)
           case $LINE_TEXT in
               *_Terms_*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
                        esac
           ;;
       *$ARCH_PATTERN4*)
                        case $LINE_TEXT in
               *DeductionRequest_*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
                        esac
           ;;
       *$ARCH_PATTERN5*)
           case $LINE_TEXT in
               *SalemFive_*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
               *SalemFiveBenefits_*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
           esac
           ;;
       *$ARCH_PATTERN6*)
           case $LINE_TEXT in
               *_DeductionReport_*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
                        esac
           ;;
                  *$ARCH_PATTERN7*)
           case $LINE_TEXT in
               *_DeductionRegister_*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
                        esac
           ;;
       *$ARCH_PATTERN8*)
           case $LINE_TEXT in
               *Billing*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
               *billing*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
           esac
           ;;
       *$ARCH_PATTERN9*)
           case $LINE_TEXT in
               *DedReg_*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
                        esac
           ;;
       *$ARCH_PATTERN10*)
           case $LINE_TEXT in
               *.FIL*)
                   echo $LINE_TEXT >> $ARCH_FILES
                   ;;
                        esac
           ;;
       *$ELIG_PATTERN1*)
           echo $LINE_TEXT >> $ELIG_FILES
           ;;
       *$ELIG_PATTERN2*)
           case $LINE_TEXT in
               *Eligibility_*)
                   echo $LINE_TEXT >> $ELIG_FILES
                   ;;
                        esac
           ;;
       *$NAME_PATTERN1*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$NAME_PATTERN2*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$NAME_PATTERN3*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$NAME_PATTERN4*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$NAME_PATTERN5*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$NAME_PATTERN6*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$NAME_PATTERN7*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$NAME_PATTERN8*)
           echo $LINE_TEXT >> $NAME_FILES
           ;;
       *$DECRYPT_PATTERN*)
           echo $LINE_TEXT >> $DECRYPT_FILES
           ;;
       *$CONV_PATTERN1*)
           echo $LINE_TEXT >> $CONV_FILES
           ;;
       *$CONV_PATTERN2*)
           echo $LINE_TEXT >> $CONV_FILES
           ;;
       *$DISNEY_PATTERN*)
           echo $LINE_TEXT >> $DISNEY_FILES
           ;;
       *$GATE_PATTERN*)
           echo $LINE_TEXT >> $GATE_FILES
           ;;
       *)
           echo $LINE_TEXT >> $NOCLASS_FILES
           ;;
   esac
done < $INPUT_FILE

------------------------------------------------