Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting all output to a log file with many command... 1

Status
Not open for further replies.

jouell

MIS
Nov 19, 2002
304
US
Hi.

I am doing this:

{
....other commands
find / -ctime +5 -name \*.gz -exec ls -l {} \;
find / -ctime +5 -name \*.gz -exec rm -e {} \;
....other commands

} | tee log 2>&1
cat log | mail me


How do I capture the output from "rm -e" into the same log file as all the other commands? I have tried doing

find / -ctime +5 -name \*.gz -exec rm -e {} \; 2>log

and

find / -ctime +5 -name \*.gz -print | xargs rm -e 2> log

without any luck so far.

Thanks!
-John








 
Hi,

use '>>' to add lines instead of '>' wich blancks the file at the beginning

Code:
ls > /tmp/file.log # create the file /tmp/file.log
ls /bin >> /tmp/file.log # add lines to the exsting file or create it if it does not exist
 
hoinz,

you nailed it!

I assume I was not explicitly grouping all the stderr dong it the way I had.


I meant to type ">>" in my other examples below, but thanks for the help, aau.

-John

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top