How redirect standard output to a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How redirect standard output to a file
# 1  
Old 05-21-2010
How redirect standard output to a file

Hi guys,
i have a script named purgeErrors.ksh, when i execute this script i need to redirect the output to a log file in the same directory, how can i do that ??
-- Aditya
# 2  
Old 05-21-2010
Code:
purgeErrors.ksh > logfile

# 3  
Old 05-21-2010
are you new to the unix??
# 4  
Old 05-21-2010
Suppose if i have a sequence of Sybase commands with print commands in them, how do i redirect them to log file ??

Eg :

echo "Print it 1"
isql -Uusername -Ppassword -Sserver <<-EOF
print "Print it 2"
EOF
# 5  
Old 05-21-2010
Try:
Code:
echo "Print it 1"
isql -Uusername -Ppassword -Sserver > logfile <<-EOF
print "Print it 2"
EOF

# 6  
Old 05-24-2010
1) It isn't working could anybody suggest any other answer ??

2) Also i have input queries while the script is running how can i redirect the entire standard output expect that input parameter queries for the script so that these user can see input parameter queries at the command line itself ??

--- Aditya

Quote:
Originally Posted by Scrutinizer
Try:
Code:
echo "Print it 1"
isql -Uusername -Ppassword -Sserver > logfile <<-EOF
print "Print it 2"
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

2. Red Hat

Command understanding the output file destination in case of standard output!!!!!

I ran the following command. cat abc.c > abc.c I got message the following message from command cat: cat: abc.c : input file is same as the output file How the command came to know of the destination file name as the command is sending output to standard file. (3 Replies)
Discussion started by: ravisingh
3 Replies

3. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

4. UNIX for Dummies Questions & Answers

Redirect Standard output and standard error into spreadsheet

Hey, I'm completely new at this and I was wondering if there is a way that I would be able to redirect the log files in a directories standard output and standard error into and excel spreadsheet in anyway? Please remember don't use too advanced of terminology as I just started using shell... (6 Replies)
Discussion started by: killaram
6 Replies

5. Shell Programming and Scripting

Sed does not make changes in the file but to the standard output

I have an xml file. I am doing some change, say deleting line 770. File name is file.xml. I use: sed '770d' file.xml but this does not actually make changes in the *file* but shows the changes on standard output (screen) if i use $var=`sed '770d' file.xml` echo $var > file.xml this... (3 Replies)
Discussion started by: indianjassi
3 Replies

6. Programming

Redirect Standard Output Multi-Process

Hi, I'm trying to compile the following code: /************** Begin <test.c> ***************/ /* * Compiled with: gcc -Wall -o test test.c */ #include <stdio.h> #include <unistd.h> int main(void) { printf("I'm process %d, son of %d \n", getpid(), getppid()); ... (5 Replies)
Discussion started by: djodjo
5 Replies

7. Shell Programming and Scripting

redirect only the standard error output to mail

I'm writing a script using file descriptor 2 (std error) to send an email only if the command fails or errors out but the script always emails me irrepective of whether it fails or not. It will not email the /tmp/check.error file output if doesn't error out just the mail with the subject "Cannot... (3 Replies)
Discussion started by: barkath
3 Replies

8. UNIX for Dummies Questions & Answers

Question from a newbie. How to redirect standard output

I have a program that is sending error text to the console and I need to redirect that output to a log file. I'm brand new to Unix and don't know how to do this. Any direction would be greatly appreciated. (1 Reply)
Discussion started by: ndemos
1 Replies

9. Shell Programming and Scripting

file content to standard output from a script

hi folks how do i output contents of file in standard output. in my script, i say x=`cat filename' echo $x below is the actual file *********** asda afdf fdf sdf dsfsdfsd fds dsfdfsdfsdg ssgd sgdg sdfsdgfsdg dgfd gsfd gs sdg sfdg s in my script, i am trying to output the... (4 Replies)
Discussion started by: bryan
4 Replies

10. UNIX for Dummies Questions & Answers

redirect standard error into log file

Hi, I am new in shell scripting. Can anyone point out what wrong of below script. If I want the error output to "sqlerror.log" and database pool data output to "bulk_main.dat". Right now, the below script, if successful execute, the data will output to bulk_main.dat && sqlerror.log both... (7 Replies)
Discussion started by: epall
7 Replies
Login or Register to Ask a Question