How to read the nth character from the line.?

I have Index Line and I tried to get the 9th character from the file and to check the character is "|" or not.
Shell Scripting.

Sample Index file.

"91799489|K8E|188.004.A.917994892.1099R.c.01.pdf|2013|10/15/2014|002|B|C|C"
"917994898|K8E|188.004.A.917994892.1099R.c.01.pdf|2013|10/15/2014|002|B|C|C"
FIRSTLINE=`head -n 1 $indexFile

   while read -r line
   do
   id = cut -c 9 $FIRSTLINE
   echo $id 
done < "$indexFile"

For the last time, please do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.

1 Like

Welcome to the forum.

You've been told twice already to

Sorry, this thread is closed again.

1 Like