problem parsing process-output

HI all!

I have a problem parsing the output of another process. The output is like this (C):

 printf("\rCheck exist: %d/%d",idx,pBF->NBits());

The aim of the script I'm coding is to save in a separate file the last output line of first process.
This is the script now (Shell script):

nohup long_process | 
while read line ; do
echo $line  > stdout.file
done

The problem comes with the lines with carriage returns (\r), that they're not saved in the file.

I tried with $sed 's/\r/\n/g' , with $tr -r '\r' , etc,. with no result

Anybody can help me?
thanks

If you want to remove the '\r' character you can do :

nohup long_process | tr -d '\r |
while read line ; do
echo $line  > stdout.file
done

If you prefer replacing '\r' by a new line :

nohup long_process | tr '\r' '\n' |
while read line ; do
echo $line  > stdout.file
done

Jean-Pierre.

Thx Jean pierre, but your solutin seems to not work properly. First solution works ok, but lines with \r not appear in the file.

The second solution doesn't show any line, seems that while loop not read any line..

If interests to somebody, I solved this problem changing the read line delimitier:

while read -d ':' line ; do

Because lines always end with : The \r delimitier does not work properly

Cheers