Problems with tee command.

for i in /tmp/*filex*; do echo $i |sed 's/\/tmp/infofiles\/infosize\/db\/files\///g';done 2>&1 |tee>output
|

The script works fine, but I cannot get the output to go to the screen and output at same time. I've tried tee -a tee and a number of commands but the only way I can get it working is to pipe it to a file and then on another line cat the file. Does anyone know how to do this with tee? I have tried even putting the commands in the loop.

If you don't redirect the output of tee, it will go to standard output -- the terminal. You see no output because you have redirected standard output into a file.

Just tell tee the output file instead of redirecting it.

 ... | tee outputfile

Too Easy! Kept thinking you would need the > symbol in some place! Thanks!

I respectfully doubt that claim. This:

sed 's/\/tmp/infofiles\/infosize\/db\/files\///g'

cannot work correctly, because the second "/" is not escaped. You probably mean

sed 's/\/tmp\/infofiles\/infosize\/db\/files\///g'

I hope this helps.

bakunin