in reply to perl ftp

perl -e "some code which is an error" 2> output.txt

perl -e "some code which is not an error" > output.txt

good luck.

Replies are listed 'Best First'.
Re^2: perl ftp
by inman (Curate) on May 20, 2005 at 14:48 UTC
    Save output and errors separately
    perl script.pl >output.txt 2>errors.txt
    Save all output in a single file
    perl script.pl >output.txt 2>&1
    You can also use the UNIX tee command to view output and save it to a file. A windows version is available from http://unxutils.sourceforge.net
    perl script.pl 2>&1 | tee stdout.txt
Re^2: perl ftp
by srini_veera (Initiate) on May 20, 2005 at 15:13 UTC
    Hi friends, please have a look at the data that i put in the mail.it contains details of the output that is sent to the STDOUT and there is no error in the script no in the output. All i want is to send the same output to some logfile. but when i tried to redirect nothing went in. I got this out put after i set the Debug option as 1 in the ftp connection. Please advice.i need the whole output to be logged. Thanks Veera
      Try the variations in my post above. Your script will use both STDOUT and STDERR. Both of these normally send output to the console where it all appears the same. The Net::FTP debug code is sent to STDERR rather than STDOUT.

      The simple redirection perl script.pl >file will send only STDOUT to the file.

      perl script.pl 2>file will send the STDERR to the file. The 2> selects STDERR as the file handle.

      This command redirects both STDOUT and STDERR to a file. perl script.pl >file 2>&1

        Hi inman , IT WORKS. thanks a lot for your help. i got what i wanted. i used the command perl script.pl 2>file thanks a lot again Bye Veera
        Hi Dear, i tried the options that you mentioned but i didnt get what i want.Any other possible way ? Please help this is what i am getting on the STDOUT ====================================================== Net::FTP=GLOB(0x4024198c)<<< 220 nti261 FTP server (Version 1.1.214.4(PHNE_30990) Mon Nov 2:47:12 GMT 2004) ready. Net::FTP=GLOB(0x4024198c)>>> user veerams Net::FTP=GLOB(0x4024198c)<<< 331 Password required for veerams. Net::FTP=GLOB(0x4024198c)>>> PASS .... Net::FTP=GLOB(0x4024198c)<<< 230 User veerams logged in. User veerams logged in. |230 Net::FTP=GLOB(0x4024198c)>>> CWD ~/working Net::FTP=GLOB(0x4024198c)<<< 250 CWD command successful. CWD command successful. |250 Net::FTP=GLOB(0x4024198c)>>> PORT 10,201,15,62,228,180 Net::FTP=GLOB(0x4024198c)<<< 200 PORT command successful. Net::FTP=GLOB(0x4024198c)>>> STOR 1 Net::FTP=GLOB(0x4024198c)<<< 150 Opening ASCII mode data connection for 1. Net::FTP=GLOB(0x4024198c)<<< 226 Transfer complete. . .. 1 2 a b c d f s zOpening ASCII mode data connection for 1. Transfer complete. |226 ===================================== and this is what is being put in the logfile ================================================ User veerams logged in. |230 CWD command successful. |250 Opening ASCII mode data connection for 1. Transfer complete. |226 /home/veerams/source/1 Opening ASCII mode data connection for 2. Transfer complete. |226 /home/veerams/source/2 Opening ASCII mode data connection for a. Transfer complete. |226 ======================================= i want the whole output that i am getting on the STDOUT into the logfile and not the one that i am getting now Any way out ? please help Thanks in advance Veera