Reading a file

Hi,

I want to read a file whic is a data file with 3 fields and look for a perticular pattern and insert that record in to the data base.

I'm trying like this it is not workin please some one help me

for line in `cat file.out`;
do
Name="echo \$line | awk '{print $2}'"
If ( Name -eq val)
then
<insert code> val table
done
while read first Name third
do

If ( Name -eq val)
then
<insert code> val table

done < file.out

Hi Anbu,

Thanks for your reply, this is not working

I have data file

which have three fields

  1. date
  2. value
  3. name

what I want to do is looking into the each line of the file if name of the file is equal to
name1 insert that record into the name1 table...if the name is name2 insert that record into name2 table....name3 record into name3 table...ect

Please let help me out.

thanks
sekhar

I just showed you way to read from the file. did you modify If statement and insert statement to get desired result?