I have prepared the shell script. Thanks.
Pls see the shell script:
Code:
TestValid()
{
while read -r line
do
echo ${line} | awk -F"|" '{
if (NF == sep_num)
printf("%s\n", $0) >> fname"_valid_rec";
else
printf("%s\n", $0) >> fname"_invalid_rec"
}' sep_num="${2}" fname="${1}"
done < ${1}
}
while read -r col1 col2
do
if [ -f ${col1}"_valid_rec" ]; then
rm ${col1}"_valid_rec"
fi
if [ -f ${col1}"_invalid_rec" ]; then
rm ${col1}"_invalid_rec"
fi
TestValid ${col1} ${col2}
if [ -f ${col1}"_invalid_rec" ]; then
mv ${col1} ${col1}"_org"
fi
if [ -f ${col1}"_valid_rec" ]; then
mv ${col1}"_valid_rec" ${col1}
fi
done < para_new.cfg