reading fixed length flat file and calling java code using shell scripting

I am new to shell scripting and I have to to the following

I have a flat file with storename(lenth 20) , emailaddress(lenth 40), location(15). There is NO delimiters in that file.

Like the following str00001.txt

StoreName emailaddress location


xxxxxxx iiiiiiiiii@yahoo.com mmmmm
yyyyyyyyyyy acb@gmail.com lllllllllllllllllllllllll
zzz zzz@email.com ujeuri

I have to read line by line in the flat file get the email address and location and then make a call my java servlet by passing in the URL

  1. Read line by line
  2. Set email address and location in a variable
    String email = "acb@gmail.com�;
    String loc = �lllllllllllllllllllllllll�;
  3. set it my url like this (i know how to call the servlet through shell scripting)

http://localhost:8080/emailer/sslPages/sendemailservlet?emailAddress= email% location= loc
4. process next line from the flat file (loop until end of the file)
5. end of the loop I have to delete str00001.txt file

Hi Gurus,

Thanks in advance...

I am new to writing shell scripting and help me out reading a flat file with fixed length.

I have a fixed length flat file with storename(lenth 6) , emailaddress(lenth 15), location(10). There is NO delimiters in that file.

Like the following str00001.txt

StoreName emailaddress location


xxxxxxiiiiiiiiii@yahoo.com mmmmm
yyyyy aewwcb@gmail.com lllllllllllllllllllllllll

  •    [email]zzzz@email.com[/email]             ujeuri
    

I have to read line by line in the flat file get the email address and location.and set it in a string

  1. Read line by line
  2. Set email address and location in a variable
    String email = "iiiiiiiiii@yahoo.com�;
    String loc = � mmmmm�;
  3. if (email == null)
    throught error
    else loc == null
    thorugh error
  4. end of the loop I have to delete str00001.txt file

Just yesterday was this example.

---------- Post updated at 08:44 AM ---------- Previous update was at 08:42 AM ----------

Add this test after you parsed the fields.

if [ "$email" = "" ] ; then
   echo "no email" >&2
else
   loc=""
fi

Use the dd command to add carriage control information to the file. Write the output of the dd command to a new temp file or you can read from stdout

dd if=inputfile  cbs=75 conv=unblock | 
while read junk email location
do
  # your code here
done