I have a homework and I tried to work on this but unable to find the solution. Can someone help me how to resolve the issue.
I have a package file and it contains text file as prod.ame300_000001.101414145111.A.txt.
In the text file it contains pdf file (222222222|ZRF|2008.pdf|2008|01/29/2009|001|B|C|C)
Step1:
I have to check the index file is for A file or B file.
Step 2:
Read the first line of the original index file.
Step 3:
Read the 9th character of the line and check if the character is �|� or not
Step 4:
Based on the above, if it is �|�, it means the package is for A file, if not, it is for B file.
Step5:
Create a variable named �isA� and assign �true� or �false� value based on the above condition.
Please find the below code I have tried:
if [ -f "$indexFile" ]
then
echo "A"$indexFile" exist."
FIRSTLINE=`head -n 1 $indexFile
while read -r line
do
id = cut -c 9 $FIRSTLINE
echo $id
done < "$indexFile"
else
echo "A" $indexFile" does not exist"