Output file content

Hi, When i run a script it is showing me the whole authentication and data to be copied on screen

 
server1:/sasdata/script#sh .TR_CNTO328.sh
**************************************************
*********************NOTICE***********************
This system is restricted to authorized users
for business purposes only.
Unauthorized access or use is a violation of
company policy and the law.
This system may be monitored for administrative
and security reasons.
By proceeding, you acknowledge that (1) you
have read and understand this notice and (2)
consent to system monitoring.
**************************************************
**************************************************
ae.sas7bdat.lck 100% 24KB 24.0KB/s 24.0KB/s 00:00
**************************************************
*********************NOTICE***********************
This system is restricted to authorized users
for business purposes only.
Unauthorized access or use is a violation of
company policy and the law.
This system may be monitored for administrative
and security reasons.
By proceeding, you acknowledge that (1) you
have read and understand this notice and (2)
consent to system monitoring.
**************************************************
**************************************************
TR_CNTO328.log 100% 0 0.0KB/s 0.0KB/s 00:00

,
but when i run this script

 
server1:sh .TR_CNTO328.sh > TR_CNTO328.log

TR_CNTO328.log shows only authnetication not copied data.
I need to get written this data in log file. Please suggest

Use this

server1:sh .TR_CNTO328.sh >> TR_CNTO328.log 2>&1

thanks,
venkat

thanks for reply i will try nad let you know

Try this:

 
sh .TR_CNTO328.sh > TR_CNTO328.log 2>&1

Or:

sh TR_CNTO328.sh |tee -a TR_CNTO328.log 

still getting same not copied data

In that case, try the tee option given. You're looking for the stats echoed by an internal call to something like SSH...but only managing to capture the banners of the remote system(s). The tee should just capture all terminal output.

This is output

,
and

that is all i am looking for .log file must exist the entry of copied files.
i tried with your suggestion but same result.

Do you have any control over the TR_* script itself? Seems like it's own echoes to screen would need to be told to rediect to STDOUT (ie, >&1).

how to get the STDOUT file so that it contain all the entries of files?
I am trying but not geting as excepted result. you guys have any clue my command follows

From here I cannot be certain of what the TR_CNTO328.sh script is doing, but it seems like a banner from an SSH or SCP/SFTP connection. Based on your session listing from earlier, it looks like the stats from a file transfer.

My earlier suggestion had been to ensure that the script's connection(s) are forced to STDOUT from within the script. Have you tried this, or is the script something you cannot edit?

thanks for reply curleb

I have copy.sh script and content of script is as follows

 
cd /sasdata/script
sh .TR_CNTO328.sh 2>&1 | tee -a TR_CNTO328.log
wait
sh .CNT06785.sh 2>&1 | tee -a CNT06785.log
wait
sh .CNT0328.sh 2>&1 | tee -a CNTO328.log
wait
sh .CNT01275.sh 2>&1 | tee -a CNT01275.log
wait
sh .CNT0148.sh 2>&1 | tee -a CNT0148.log
wait
exit

and content of TR_CNTO328.sh script. this script transfer data to another server and i need the output of this script to say TR_CNTO328.log file

 
STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 12096000);
printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm')
touch $STAMP /sasdata/CNTO1275/C0743T23/Final_DBL/Analysis
cd /sasdata/CNTO1275/C0743T23/Final_DBL/Analysis 
find . -type f -newer . -exec scp -p {} sasadmin@cua35132sas101:/sasdata/CNTO1275/C0743T23/Final_DBL/Analysis ';' ;
STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 86400);
printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm')
touch $STAMP /sasdata/CNTO1275/C0743T23/Final_DBL/Data
cd /sasdata/CNTO1275/C0743T23/Final_DBL/Data  
find . -type f -newer . -exec scp -p {} sasadmin@cua35132sas101:/sasdata/CNTO1275/C0743T23/Final_DBL/Data ';' ;
STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 86400);
printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm')
touch $STAMP /sasdata/CNTO1275/C0743T23/Final_DBL/Docs
cd /sasdata/CNTO1275/C0743T23/Final_DBL/Docs
find . -type f -newer . -exec scp -p {} sasadmin@cua35132sas101:/sasdata/CNTO1275/C0743T23/Final_DBL/Docs ';' ;
 

any clue?