Suppose there are two type of csv files with the following filename format:Ass_B1_v1_<ShortName>_<ddmmyyyy>.CSVCATUpd_v1_<ShortName>_<ddmmyyyy>.CSVOr the format can be changed to:Ass_B1_v1_<ShortName>_<Name>_<ddmmyyyy>.CSVCATUpd_v1_<ShortName>_<Name>_<ddmmyyyy>.CSVThe <ShortName> are the short form of Name:Name|ShortNameA1 Dun|A1Ant Cap|AC...I have a list consisting Part_Name & Target_Directory whichPart_Name=echo ${Name} | sed -e 's/ /_/'Target_dir=D:\GFTPRoot\Receive\${Part_Name}\LIST\ASCII\OUTList.txt:Part_Name|Target_DirectoryA1_Dun|D:\GFTPRoot\Receive\A1_Dun\LIST\ASCII\OUTAnt_Cap|D:\GFTPRoot\Receive\Ant_Cap\LIST\ASCII\OUTBri_Deb|D:\GFTPRoot\Receive\Bri_Deb\LIST\ASCII\OUT...I normally hard-code this & assigned the parameter by reading the parameter from the list(For example, List.txt)[ ${ShortName} = A1 ] && {part=`grep ^$A1_Dun ${List} | cut -d| -f1`Target_dir=`grep ^$A1_Dun ${List} | cut -d| -f2`}[ ${ShortName} = AC ] && {part=`grep $Ant_Cap ${List} | cut -d| -f1`Target_dir=`grep $Ant_Cap ${List} | cut -d| -f2`}...for file in `find ${path} -name *${ShortName}* -type f`do..The list is quite long. Instead of hard-coding, I wish to search all the csv files with the pattern *$ShortName*, then assigned $Part_Name & $Target_dir to the $ShortName.For example, for all the csv files with the particular pattern *$ShortName*,assign the parameter Part_Name & Target_dir for each sub-set of files with the particular pattern.
How to perform automatic parameter assignment according to the pattern of filename?
bash;directory;filenames;parameter;patterns