cat file problem

Hi,

I wnat to read a fiel line by line and store each line in a variabel, so I made a for loop:

for i in `cat file` ; do
#do sth.

done;

The problem is, that in the file, there are lines with only asterisks like this
**************************************************************************************************

When I read this line, then not the asteriks are stored in $i, but in $i is the content of ls line by line is in my variabel $i.

How can I solve this??

Thx

Ben sky

Hi,
What if you try changing the special char. '*' to let's say a minus '-' and convert it back when needed:

for i in `sed -e 's/\/\-/g' file`
do
echo $i | sed -e 's/\-/\
/g'`
# do smth
done

Might help ?

This method works for me

while read line
do
echo "$line"
done < filename

Note the double quotes round the variable

Strangely enough the quotes don't work using a for loop. Not sure why.

Matt.

Hi,

although its not so nice to convert the * to a - its a solution.
Thanks.